unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, StdCtrls, Spin, ExtCtrls, Gauges;
type
TRad=class(TObject)
xm,ym,w,r,s,v:integer; //W: Winkel, r: Radius, s: Speichen, v: Speed
constructor create(xmi,ymi,winkel,radius,speichen,speed:integer);
destructor destroy; override;
procedure drehe;
procedure male(modus:TPenmode); virtual;
end;
TForm1 = class(TForm)
Image1: TImage;
Panel1: TPanel;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
SpinEdit1: TSpinEdit;
TrackBar1: TTrackBar;
TrackBar2: TTrackBar;
Timer1: TTimer;
Gauge1: TGauge;
TrackBar3: TTrackBar;
procedure ImageMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure TrackBar1Change(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
Rad:TRad;
Liste:TList;
v1:integer;
implementation
{$R *.dfm}
constructor TRad.create(xmi,ymi,winkel,radius,speichen,speed:integer);
begin
inherited create;
xm:=xmi;
ym:=ymi;
w:=winkel;
r:=radius;
s:=speichen;
v:=speed;
self.male(pmcopy);
Liste.Add(self);
end;
destructor TRad.destroy;
begin
inherited destroy;
end;
procedure Trad.male(modus:TPenmode);
var an, dalpha:integer;
begin
with form1.Image1.Canvas do
begin
pen.mode:=modus;
pen.color:=clblack;
pen.width:=1;
ellipse(xm-r,ym-r,xm+r,ym+r);
an:=0;
dalpha:=360 div s;
while an<360 do
begin
moveto(xm,ym);
lineto(xm+round(r*cos((w+an)*3.14/180)),ym-round(r*sin((w+an)*3.14/180))); //Winkelberechnung
an:=an+dalpha;
end;
end;
end;
procedure Trad.drehe;
begin
w:=w+v1+v;
if w>360 then w:=w-360;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Liste:=Tlist.Create;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var i:integer;
begin
for i:=0 to liste.Count-1 do
begin
Trad(liste[i]).male(pmnotxor);
Trad(liste[i]).drehe;
Trad(liste[i]).male(pmcopy);
end;
end;
procedure TForm1.TrackBar1Change(Sender: TObject);
begin
v1:=form1.TrackBar3.Position
end;
procedure TForm1.ImageMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
Trad.create(x,y,20,form1.TrackBar2.Position,strtoint(form1.SpinEdit1.Text),form1.TrackBar1.Position);
form1.Timer1.Interval:=1;
form1.Timer1.Enabled:=true;
end;
end.