type
TForm1 =
class(TForm)
Timer1: TTimer;
Image1: TImage;
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
Winkel,v1,y1,y2: Integer;
implementation
{$R *.dfm}
procedure TForm1.Timer1Timer(Sender: TObject);
var Pos: Integer;
begin
With Image1.Canvas
do
begin
Pen.Color:=clWhite;
// Für Überarbeitung weiß
Brush.Color:=clWhite;
Rectangle(0,0,Image1.Width,Image1.Height);
Pen.Color:=clblack;
MoveTo(10,Image1.Height
div 2+20);
LineTo(10,Image1.Height
div 2-20);
// |
MoveTo(Image1.Width-10,Image1.Height
div 2+20);
LineTo(Image1.Width-10,Image1.Height
div 2-20);
// |
MoveTo(10,Image1.Height
div 2);
LineTo(Image1.Width-10,Image1.Height
div 2);
// ---
end;
Winkel:=(Winkel+v1)
mod 360;
Pos:=round( Image1.Width/2 + sin(Pi*Winkel/180)*(Image1.Width/2-25) );
// Sinus wird von Rad nach Deg umgerechnet
Image1.Canvas.rectangle(Pos-10,y1,Pos+10,y2);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
y1:=Image1.Height
div 2-10;
y2:=Image1.Height
div 2+10;
v1:=3;
Winkel:=0;
Timer1.Interval:=40;
// oder im Objektinspektor einstellen - 1000/40 -> 25 "Bilder" pro Sekunde
end;
end.