Thank you circular , the BGRA is very powerfull to make demos.
My goal is make simple and short code for each demo part eg:
Copper bars, bitmap font scroller, sinwave, blitter obj (bob) plasma and so on like Amiga demos.
After that i can combine all fx to make big demo with each part ;
So thank you again for the sinwave fx and here is the short version 60 lines with correction .
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls,
BGRAVirtualScreen, BGRABitmap, BGRABitmapTypes;
type
{ TForm1 }
TForm1 = class(TForm)
BGRAVirtualScreen1: TBGRAVirtualScreen;
Timer1: TTimer;
procedure BGRAVirtualScreen1Redraw(Sender: TObject; Bitmap: TBGRABitmap);
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
public
end;
var
Form1: TForm1;
Bmp : TBGRABitmap; // pic mean picture :)
acc : integer;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
begin
Bmp := TBGRABitmap.Create('warrior1.png');
acc := 0;
end;
procedure TForm1.BGRAVirtualScreen1Redraw(Sender: TObject; Bitmap: TBGRABitmap); // wobble or sinwave !!
var i,w : integer;
begin
i :=0; w :=0; acc := acc + 1;
for i:=0 to Bmp.Height div 5 do //
begin
w := round(50 + (10 * sin((i+acc) * 6 * PI / 180)));
Bitmap.PutImagePart(0, i*5-4 , Bmp, Rect(-50+w, i*5-4, Bmp.Width*w ,(i+1)*5-4), dmSet); // xoffset to -50 to center bmp
end;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
BGRAVirtualScreen1.RedrawBitmap;
end;
end.