pascalabcnet/InstallerSamples/Graphics/GraphWPF/anim2.pas

25 lines
599 B
ObjectPascal
Raw Permalink Normal View History

2017-12-17 14:40:06 +03:00
uses GraphWPF;
begin
2017-12-17 14:40:06 +03:00
Window.Title := 'Отражение шарика. Вещественное направление движения';
Brush.Color := Colors.Beige;
var x := 400.0;
var y := 300.0;
var dx := 2.1;
var dy := -1.2;
Circle(x,y,20);
while True do
begin
Sleep(10);
Window.Clear;
x += dx;
y += dy;
if not x.Between(0,Window.Width) then
dx := -dx;
if not y.Between(0,Window.Height) then
dy := -dy;
Circle(x,y,20);
if Milliseconds>2000 then
2017-12-17 14:40:06 +03:00
Window.Title := 'Секунды: ' + (Milliseconds div 100)/10;
end;
end.