Blame lazarus/pixel-art/flag/unit1.pas
|
|
c0c0da |
unit Unit1;
|
|
|
c0c0da |
|
|
|
c0c0da |
{$mode objfpc}{$H+}
|
|
|
c0c0da |
|
|
|
c0c0da |
interface
|
|
|
c0c0da |
|
|
|
c0c0da |
uses
|
|
|
c0c0da |
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls;
|
|
|
c0c0da |
|
|
|
c0c0da |
type
|
|
|
c0c0da |
|
|
|
c0c0da |
{ TForm1 }
|
|
|
c0c0da |
|
|
|
c0c0da |
TForm1 = class(TForm)
|
|
|
c0c0da |
Timer1: TTimer;
|
|
|
c0c0da |
procedure FormPaint(Sender: TObject);
|
|
|
c0c0da |
procedure Timer1Timer(Sender: TObject);
|
|
|
c0c0da |
private
|
|
|
c0c0da |
{ private declarations }
|
|
|
c0c0da |
public
|
|
|
c0c0da |
{ public declarations }
|
|
|
c0c0da |
end;
|
|
|
c0c0da |
|
|
|
c0c0da |
var
|
|
|
c0c0da |
Form1: TForm1;
|
|
|
c0c0da |
offset: integer = 0;
|
|
|
c0c0da |
|
|
|
c0c0da |
implementation
|
|
|
c0c0da |
|
|
|
c0c0da |
{$R *.lfm}
|
|
|
c0c0da |
|
|
|
c0c0da |
{ TForm1 }
|
|
|
c0c0da |
|
|
|
c0c0da |
procedure TForm1.FormPaint(Sender: TObject);
|
|
|
c0c0da |
var
|
|
|
c0c0da |
x, y, realX, realY: integer;
|
|
|
c0c0da |
c: TColor;
|
|
|
c0c0da |
begin
|
|
|
c0c0da |
c := clBlack;
|
|
|
c0c0da |
|
|
|
c0c0da |
for x := 0 to 250-1 do begin
|
|
|
c0c0da |
for y := 0 to 100-1 do begin
|
|
|
c0c0da |
if (x mod 50 < 25) = (y mod 30 < 15) then c := clWhite else c := clNavy;
|
|
|
c0c0da |
|
|
|
c0c0da |
//realX := 30 + x + y;
|
|
|
c0c0da |
//realY := 30 + 200 - y;
|
|
|
c0c0da |
|
|
|
c0c0da |
//realX := 30 + 2*x + 2*y;
|
|
|
c0c0da |
//realY := 30 + 200 - 2*y;
|
|
|
c0c0da |
|
|
|
c0c0da |
realX := 30 + 2*x + 2*y;
|
|
|
c0c0da |
realY := 30 + 200 - 2*y - round(10 * cos((x - offset)/10) * cos(y/10));
|
|
|
c0c0da |
|
|
|
c0c0da |
Canvas.Pixels[realX, realY] := c;
|
|
|
c0c0da |
end;
|
|
|
c0c0da |
end;
|
|
|
c0c0da |
end;
|
|
|
c0c0da |
|
|
|
c0c0da |
procedure TForm1.Timer1Timer(Sender: TObject);
|
|
|
c0c0da |
begin
|
|
|
c0c0da |
offset := offset + 1;
|
|
|
c0c0da |
Refresh;
|
|
|
c0c0da |
end;
|
|
|
c0c0da |
|
|
|
c0c0da |
end.
|
|
|
c0c0da |
|