Witam chce napisac taki sobie programik ktory po wpisaniu danych wyswiatla animacje wahadła matematycznego. Oczywiscie w pascalu czyli TurboPascal nie w delphi. Mam juz taki kodzik ale to mi działa tak ze nie idzie tak równo tylko kiedy x>0 to sie odbija jakby i idzie w góre jak zrobic zeby to było płynne przejscie?? Wiecie idealny ruch wahadła. Na razie to jest bez wzrów itd tylko zrobilem tak zeby zrobic wstepnie płynny ruch. ale mi cos nie wychodzi.
program wahadlo;
uses
crt, graph;
procedure start;
var
karta,tryb:integer;
begin
karta:=Detect;
InitGraph(karta,tryb,'E:\pascal\bgi\');
if (graphresult <> grOk) then
begin
Writeln ('Wystapil blad podczas inicjowania trybu graficznego');
end;
end;
procedure kolo(x,y: Longint;r: integer;color_ob,color_c: WORD);
var
i:integer;
begin
for i:=0 to r do
begin
if i=r then SetColor(color_ob) else SetColor(color_c);
Circle(x,y,i);
end;
end;
procedure wah;
var
x,y:integer;
c:integer;
begin
y:=0;
for x:=-200 to 200 do
begin
ClearDevice;
Circle(GetMaxX div 2 +x,GetMaxY div 2 +y,50);
{ kolo(GetMaxX div 2+x,GetMaxY div 2,50,white,red);}
Delay(1000);
if ((frac(x/10) = 0) and (x<0)) then
begin
y:=y+1;
end
else if((frac(x/10) = 0) and (x>0)) then
begin
y:=y-1;
end;
end;
end;
begin
start;
wah;
repeat until keypressed;
end.