unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TForm1 =
class(TForm)
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
private
{ Private-Deklarationen }
procedure MyPaint;
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
var
r1: single;
r2: single;
n: integer = 4;
x, y, z: integer;
Phi: single;
isMouseDown: Boolean = FALSE;
procedure TForm1.MyPaint;
var
c: Integer;
begin
with Canvas
do
begin
Brush.Color := Color;
FillRect(ClientRect);
Pen.Color := clGray;
Pen.Style := psClear;
Brush.Color := clRed;
r1 := 10;
r2 := 60;
z := round(r2 / 1.5);
for c := 0
to n
do
begin
x := round(cos(c * 2 * Pi / n + Phi) * (r1 - r2));
y := round(sin(c * 2 * Pi / n + Phi) * (r1 - r2));
FillRect(RECT(200 + x - 2, 200 + y - 2, 200 + x + 2, 200 + y + 2));
FillRect(RECT(200 + x - 2, 200 + y - 2 - z, 200 + x + 2, 200 + y + 2 - z));
end;
end;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
MyPaint;
if Phi < (2 * Pi) - 0.1
then Phi := Phi + 0.1
else Phi := 0.0;
end;
end.