unit _Main;
interface
uses Windows, Classes, Graphics, Controls, Forms, ExtCtrls;
type
TMain = class(TForm)
Timer: TTimer;
procedure FormCreate(Sender: TObject);
procedure TimerTimer(Sender: TObject);
procedure FormPaint(Sender: TObject);
end;
var Main: TMain;
implementation
{$r *.dfm}
var
Step: Double;
Bitmap: TBitmap;
Snake: array [0..255] of TPoint;
procedure TMain.FormCreate(Sender: TObject);
begin
Timer.Interval := 33;
Bitmap := TBitmap.Create;
Bitmap.Width := ClientWidth;
Bitmap.Height := ClientHeight;
end;
procedure TMain.TimerTimer(Sender: TObject);
var
Size: Double;
Value: TPoint;
Index: Integer;
begin
Size := 360 / Length(Caption);
with Bitmap.Canvas do
begin
FillRect(Rect(0, 0, Bitmap.Width, Bitmap.Height));
for Index := 1 to Length(Caption) do
with Snake[Index] do
begin
if Index > 1 then
Value := Snake[Index - 1]
else
Value := ScreenToClient(Mouse.CursorPos);
Inc(X, Round((Value.X - X) * 0.6));
Inc(Y, Round((Value.Y - Y) * 0.6));
Pixels[X, Y] := clRed; TextOut(X + Round(66 * Cos(Step + Index * Size * (Pi / 180))),
Y + Round(66 * Sin(Step + Index * Size * (Pi / 180))),
Caption[Index]); end;
end;
FormPaint(nil);
Step := Step - 0.06;
end;
procedure TMain.FormPaint(Sender: TObject);
begin
BitBlt(Canvas.Handle, 0, 0, Bitmap.Width, Bitmap.Height, Bitmap.Canvas.Handle, 0, 0, SRCCOPY);
end;
end.