This repository has been archived on 2024-12-25. You can view files and clone it, but cannot push or open issues or pull requests.
OldPascalProjects/Graphics/WPFObjects/StartStopMoveRotation.pas
2024-03-10 20:32:51 +03:00

32 lines
1.0 KiB
ObjectPascal
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Модуль Controls - StatusBar
uses Controls,WPFObjects;
// Управление свойствами объекта, связанными с перемещением и поворотом.
// В OnDrawFrame объект сам себя перерисовывает
begin
Window.Title := 'Модуль Controls - StatusBar';
var l := LeftPanel(180,Colors.Orange);
var c := new RectangleWPF(50,200,80,50,Colors.Green);
c.Direction := (1,0);
c.Velocity := 0;
c.Tag := 0; // скорость поворота
OnDrawFrame := dt -> begin
c.MoveTime(dt);
c.RotateAngle += integer(c.Tag) * dt;
end;
Button('Начать перемещение').Click := procedure -> begin
c.Velocity := 30;
end;
Button('Закончить перемещение').Click := procedure -> begin
c.Velocity := 0;
end;
Button('Начать поворот').Click := procedure -> begin
c.Tag := 30;
end;
Button('Закончить поворот').Click := procedure -> begin
c.Tag := 0;
end;
end.