this slowpoke moves

Draw Gradient Plasma

procedure TForm1.FormCreate(Sender: TObject);

  { Draw 1 pixcel width line }
  procedure DrawLine(X,Y,H,L:Integer; Step:Real);
  Var
    R, C : Integer;
  Begin
     For R:=0 To H Do
     Begin
       { Change fill color }
       If R<=L Then
       Begin
          C:=Round(R*Step);
          { Black - Red }
          Image1.Canvas.Pen.Color:=RGB(C,0,0)
       End
       Else If R<=2*L Then
       Begin
          C:=Round((R-L)*Step);
          { Red - Black }
          Image1.Canvas.Pen.Color:=RGB(255-C,0,0)
       End;
       { Fill area by drawing lines }
       Image1.Canvas.MoveTo(X,Y+R);
       Image1.Canvas.LineTo(X+1,Y+R);
     End;

  End;

Var
  Angle, X, Y, H, H2, W, L : Integer;
  Step : Real;
begin
   { Get form size }
   H:=Image1.Height;
   W:=Image1.Width;

  { Fill image area by form color }
  Image1.Canvas.Brush.Color:=clBlack;
  Image1.Canvas.Pen.Color:=clBlack;
  Image1.Canvas.Rectangle(0,0,W,H);


   { Set fill size }
   H2:=150;
   L:=H2 Div 2;

   { Set fill step size }
   Step:=255/L;
   Angle:=0;
   For X:=1 to W Do
   Begin
      Y:=Round(100*Sin(Angle*(Pi/180)));
      DrawLine(X,(H Div 3)-Y,H2,L,Step);
      Inc(Angle);
      If Angle>360 Then Angle:=0;
   End;
end;

Keine Kommentare:

Kommentar veröffentlichen

Beliebte Posts

Translate