this slowpoke moves

Calculate SIN / COS Bezier

procedure TForm1.FormCreate(Sender: TObject);
begin
  Image1.Canvas.Brush.Color:=clBlack;
  Image1.Canvas.FloodFill(Form1.Width div 2,Form1.Height div 2,clWhite,fsSurface);
  Image1.Canvas.Pen.Color:=clYellow;
  Image1.Canvas.MoveTo(0,Image1.Height div 2);
  Image1.Canvas.LineTo(Image1.Width,Image1.Height div 2);
  Image1.Canvas.MoveTo(Image1.Width div 2,0);
  Image1.Canvas.LineTo(Image1.Width div 2,Image1.Height);
end;

procedure TForm1.CosButtonClick(Sender: TObject);
var x: real;
    sx,sy: integer;
begin
  x:=-15;
  sy:=Image1.Height div 3;
  sx:=Image1.Width div 30;
  while x<15 do
  begin
  Image1.Canvas.Pixels[trunc(sx*x)+Image1.Width div 2,Image1.Height div 2-trunc(sy*cos(x))]:= ClRed;
  x:=x+0.001;
  end;
end;

procedure TForm1.SinButtonClick(Sender: TObject);
var x: real;
    sx,sy: integer;
begin
  x:=-15;
  sy:=Image1.Height div 3;
  sx:=Image1.Width div 30;
  while x<15 do
  begin
  Image1.Canvas.Pixels[trunc(sx*x)+Image1.Width div 2,Image1.Height div 2-trunc(sy*sin(x))]:= ClLime;
  x:=x+0.001;
  end;
end;

Keine Kommentare:

Kommentar veröffentlichen

Beliebte Posts

Translate