Demoscene Square dot flag fx lazarus / 39-Graphics ---------------------------------------------------------------------- Gigatron · 2024-04-13 18:42 Hi nice ladies and gentlements I would like to share a nice fx from Amiga demoscene , dot flag fx from skid row cracktro ; BGRA component used of course; https://www.youtube.com/watch?v=h7XvL-wNjNY Amiga Skid row: https://www.youtube.com/watch?v=ajAlW2pMVHw pascal code : Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit Unit1; {$mode objfpc}{$H+} interface uses  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,  ComCtrls, StdCtrls, BGLVirtualScreen, BGRAOpenGL, BGRABitmap, BGRABitmapTypes,  uplaysound;  type   { TForm1 }     TForm1 = class(TForm)    BGLVirtualScreen1: TBGLVirtualScreen;    Button1: TButton;    Label1: TLabel;    playsound1: Tplaysound;    Timer1: TTimer;    TrackBar1: TTrackBar;    TrackBar2: TTrackBar;    TrackBar3: TTrackBar;    procedure BGLVirtualScreen1Redraw(Sender: TObject; BGLContext: TBGLContext);    procedure Button1Click(Sender: TObject);    procedure FormShow(Sender: TObject);    procedure Timer1Timer(Sender: TObject);      private     plasma : IBGLTexture;     public    var    ct, tval: integer;   end; var  Form1: TForm1;  implementation {$R *.lfm}  { TForm1 } procedure TForm1.FormShow(Sender: TObject);begin // plasma := BGLTexture('plasma9.jpg');end; procedure TForm1.BGLVirtualScreen1Redraw(Sender: TObject;   BGLContext: TBGLContext);var   i,j,p,r,x,y :integer;   rs,sx,sy : double;   col: TColor; begin   p := 0;  r := 0;   for i := 0 to 30 do     begin       r:=r +1;    for j:=0 to 20 do       begin        p:= p + TrackBar2.Position;        x:= i * 16  ;        y:= j * 16  ;         rs := sin((p+r+ct*(PI/180)*TrackBar3.Position)); // speed        sx :=   (TrackBar1.Position*rs);        sy :=   (TrackBar1.Position*rs);       sx := abs(sx);        sy := abs(sy);         x:=   round(x +  (110-sx)/2);        y:=   round(y +  (60-sy)/2);        col := RGBToColor( TrackBar2.Position div 2, TrackBar2.Position div 3,TrackBar2.Position div 4);        BGLContext.Canvas.fillrect(x,y,x+sx,y+sy, col);      //  BGLContext.Canvas.fillrect(x,y,x+sx-2 ,y+sy-2, RGBToColor(160,160,160));         end;  end; end; procedure TForm1.Button1Click(Sender: TObject);begin  playsound1.Execute;end; procedure TForm1.Timer1Timer(Sender: TObject);begin    ct := ct +1;    Label1.caption := IntToStr(TrackBar2.Position);    BGLVirtualScreen1.Repaint;end; end.  Enjoy and play ! ---------------------------------------------------------------------- TRon · 2024-04-14 18:00 Nice, Gigatron !! One of those routines that can be shaped and molded to do many things. I really should dust of some of my old stuff. Do note that it took a lot less time with the copper and blitter to realize then what is shown in code here  I took the liberty to get things going with ptcpas and toyed with it (only) a little. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program squaring; {$mode objfpc}{$h+} {.$define draw_tile_as_rectangle}{$define draw_tile_as_circle} uses  {$ifdef linux}  cthreads,  {$endif}  classes,  sysutils, fptimer,  ptccrt, ptcgraph; {$if sizeof(colortype) = 4}  {$define FPC_GRAPH_SUPPORTS_TRUECOLOR}{$endif}  type  TEvents = object    procedure DoTimer(Sender: TObject);  end; const  FPS_TO_AIM_FOR   = 50; // 25; const  TILES_SPEED      =   4;                   // 0..16  TILES_SQUARESIZE =  32;  TILES_SKIPDELAY  = 100; // 7;             // 5..255  TILES_COLCOUNT   =  40;  TILES_ROWCOUNT   =  10;  TILES_AMP      = TILES_SQUARESIZE - 2;  // 10..20   // dirty dimensions  XOFS   = 20;  YOFS   = 20;  WIDTH  = TILES_COLCOUNT * TILES_SQUARESIZE;  HEIGHT = TILES_ROWCOUNT * TILES_SQUARESIZE;  var  Events     : TEvents;  Timer      : TFPTimer;  framecount : integer = 0;  procedure Render;var  i,j,p,r,x,y : integer;  rs,sx,sy : double;  col : Colortype;  cc : byte;begin  p := 0;  r := 0;   for i := 0 to TILES_COLCOUNT-1 do  begin    r := r + 1;     for j := 0 to TILES_ROWCOUNT-1 do    begin      p := p + TILES_SKIPDELAY;      x := i * TILES_SQUARESIZE;      y := j * TILES_SQUARESIZE;       rs := sin((p+r+framecount*(PI/180)*TILES_SPEED)); // speed      sx := TILES_AMP*rs;      sy := TILES_AMP*rs;       sx := abs(sx);      sy := abs(sy);       x := XOFS + round(x + (TILES_AMP-sx)/2);      y := YOFS + round(y + (TILES_AMP-sy)/2);       {$ifdef FPC_GRAPH_SUPPORTS_TRUECOLOR}      cc  := round(sy * 255 / TILES_AMP);      col := cc shl 16 + cc shl 8 + cc shl 0;      {$else}      // TODO:      // col := index to palette      {$endif}       {$if defined(draw_tile_as_rectangle)}      SetColor(col);      Rectangle(x,y,round(x+sx),round(y+sy));      {$elseif defined(draw_tile_as_circle)}      SetColor(col);      Circle(x + TILES_AMP shr 1, y + TILES_AMP shr 1, round(sx/2));      {$else}      SetFillStyle(SolidFill, col);      Bar(x,y,round(x+sx),round(y+sy));    {$endif}    end;  end;end;  procedure TEvents.DoTimer(Sender: TObject);const  ActivePage : integer = 1;begin  inc(framecount);   // Swap buffers  ActivePage := 1 - ActivePage;  SetActivePage(ActivePage);   // Clear buffer and render view  ClearDevice;  Render;   // Update view  SetVisualPage(ActivePage);end;  procedure CheckGraphResult;var  ErrorCode: Integer;begin  ErrorCode := GraphResult;  if ErrorCode <> grOk then  begin    CloseGraph;    Writeln(ErrorCode, ': ', GraphErrorMsg(ErrorCode));    Readln;    Halt(1);  end;end;  procedure GfxModeInfo;var  n     : smallint;  color : RGBRec;begin  writeln('BGColor      = ', GetBkColor);  writeln('FGColor      = ', GetColor);  writeln('PaletteSize  = ', GetPaletteSize);  writeln('DirectVideo  = ', GetDirectVideo);  writeln('DriverName   = ', GetDriverName);  writeln('maxColor     = ', GetMaxColor);  writeln('GraphMode    = ', GetGraphMode);  writeln('ModeName     = ', GetModeName(GetGraphMode));   // info on some random colors  for n := 0 to 9 do  begin    GetRGBPalette(n, color.Red, color.Green, color.Blue);    writeln('$', color.Red.ToHexString, '.', color.Green.ToHexString, '.', color.Blue.ToHexString);  end;end;  var  gd, gm: smallint;begin  gd := detect;  gm := 0;   InitGraph(gd,gm,'');  CheckGraphResult;   {$ifndef FPC_GRAPH_SUPPORTS_TRUECOLOR}  // TODO: set palette  SetRGBPalette(1, $FF, $0, $0);  CheckGraphResult;  {$endif}  GfxModeInfo;   writeln('Effect:');  writeln('PixelWidth  = ', WIDTH);  writeln('PixelHeight = ', HEIGHT);  writeln;   Timer := TFPTimer.Create(nil);  Timer.Enabled        := false;  Timer.UseTimerThread := true;  Timer.Interval       := round(1000 / FPS_TO_AIM_FOR);  Timer.OnTimer        := @Events.DoTimer;  Timer.Enabled        := true;   // let Timer do its job and wait for user intervention  repeat    delay(10);  until keypressed;   Timer.Free;   CloseGraph;end. ---------------------------------------------------------------------- Gigatron · 2024-04-14 21:22 Thank you Tron for the code which gives infinite ideas and possibilities. I'm just giving the code which is similar to the Skid Row cracktro, of course the program is not optimized and made as simply as possible in order to help anyone who would like to code effects Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit Unit1; {$mode objfpc}{$H+} interface uses  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,  ComCtrls, StdCtrls, BGLVirtualScreen, BGRAOpenGL, BGRABitmap, BGRABitmapTypes,  uplaysound;  type   { TForm1 }     TForm1 = class(TForm)    BGLVirtualScreen1: TBGLVirtualScreen;    Button1: TButton;    Label1: TLabel;    playsound1: Tplaysound;    circle_radio: TRadioButton;    sq_radio: TRadioButton;    Timer1: TTimer;    TrackBar1: TTrackBar;  TrackBar2: TTrackBar;    TrackBar3: TTrackBar;    procedure BGLVirtualScreen1Redraw(Sender: TObject; BGLContext: TBGLContext);    procedure Button1Click(Sender: TObject);    procedure Timer1Timer(Sender: TObject);      private     public    var    ct, tval: integer;    shape_type: integer;   end; var  Form1: TForm1;  implementation {$R *.lfm}  { TForm1 } procedure TForm1.BGLVirtualScreen1Redraw(Sender: TObject;   BGLContext: TBGLContext);var   i,j,p,r,x,y :integer;   rs,sx,sy : double;  begin   p := 0;  r := 0;   for i := 0 to 14 do  begin        r:=r +1;    for j:=0 to 11 do       begin        p:= p + TrackBar2.Position;        x:= i * 32  ;        y:= j * 32  ;         rs := sin((p+r+ct*(PI/180)*TrackBar3.Position)); // speed        sx :=   (TrackBar1.Position*rs);        sy :=   (TrackBar1.Position*rs);       sx := abs(sx);        sy := abs(sy);         x:=   round(x +  (120-sx)/2);        y:=   round(y +  (54-sy)/2);         if(shape_type=1) then begin          BGLContext.Canvas.fillrect(x,y,x+sx,y+sy, RGBToColor(0,220,255 ));        BGLContext.Canvas.fillrect(x+2,y+2,x+sx-2,y+sy-2, RGBToColor(0,110,255 ));        end;         if(shape_type=2) then begin         BGLContext.Canvas.Arc(x,y,sx / 3,sy/ 3,0,360, RGBToColor(0,180,255 ),true,RGBToColor(0,110,255 ));        end;       end;  end; end; procedure TForm1.Button1Click(Sender: TObject);begin  playsound1.Execute;end; procedure TForm1.Timer1Timer(Sender: TObject);begin    ct := ct +1;    Label1.caption := IntToStr(TrackBar2.Position);    BGLVirtualScreen1.Repaint;    if(sq_radio.Checked) then shape_type := 1;    if(circle_radio.Checked) then shape_type := 2; end; end. ---------------------------------------------------------------------- circular · 2024-04-15 07:00 Hi Gigatron, In the Skid Row demo, it seems to me that it is a gradient. You can do something similar like this (not tested): Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses BGRAGradientScanner; procedure TForm1.BGLVirtualScreen1Redraw(Sender: TObject;   BGLContext: TBGLContext);var   i,j,p,r,x,y :integer;   rs,sx,sy : double;   grad: TBGRACustomGradient; begin   p := 0;  r := 0;  grad := TBGRAMultiGradient.Create([CSSDodgerBlue, CSSBlue, CSSLightGray],       [0, 0.4, 1], grPad);   for i := 0 to 14 do  begin        r:=r +1;    for j:=0 to 11 do       begin        p:= p + TrackBar2.Position;        x:= i * 32  ;        y:= j * 32  ;         rs := sin((p+r+ct*(PI/180)*TrackBar3.Position)); // speed        sx :=   (TrackBar1.Position*rs);        sy :=   (TrackBar1.Position*rs);       sx := abs(sx);        sy := abs(sy);         x:=   round(x +  (120-sx)/2);        y:=   round(y +  (54-sy)/2);         if(shape_type=1) then begin          BGLContext.Canvas.fillrect(x,y,x+sx,y+sy, grad.GetColorAtF((i+j)/(14+11)));        end;         if(shape_type=2) then begin         BGLContext.Canvas.Arc(x,y,sx / 3,sy/ 3,0,360, RGBToColor(0,180,255 ),true,RGBToColor(0,110,255 ));        end;       end;  end;  grad.Free; end; ---------------------------------------------------------------------- TRon · 2024-04-15 08:04 Quote from: circular on April 15, 2024, 09:00:28 amIn the Skid Row demo, it seems to me that it is a gradient. That is indeed correct. Seems they used the copper for that (hence why the squares have a certain width) to draw the squares from dark (left top) to light (bottom right) though the effect seem to "overlap" a little (seem to be static but could be made to animate as well for extra wow factor). ---------------------------------------------------------------------- Gigatron · 2024-04-15 18:01 Quote from: circular on April 15, 2024, 09:00:28 amHi Gigatron, In the Skid Row demo, it seems to me that it is a gradient. Hi Circular sure you are right; Here are the trick used in Skid Row intro; One is the white square , and it use gradient mask , if i have time i will finish this intro at maximum similar ; Edit : ** In fact I don't need to do anything, I just tested your example and it works perfectly Thank you very much By the way , you certainly know the Amiga Blitter.. Can you include it in BGRA? We take part of the image and copy it elsewhere, it looks like Drawpart image like in javascript. BGRABlit(x,y,x1,y1, dx,dy) ---------------------------------------------------------------------- KodeZwerg · 2024-04-15 18:33 Quote from: circular on April 15, 2024, 09:00:28 amYou can do something similar like this (not tested):I have tested it, pretty nice one! Thanks to Gigatron for inspiration and Circular for extending. Here is my mini tiny modification so it work with any size of the virtualscreen. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.BGLVirtualScreen1Redraw(Sender: TObject;   BGLContext: TBGLContext);var  i, j, p, r, x, y : Integer;  rs, sx, sy : Double;  grad: TBGRACustomGradient;  maxColumn, maxRow: Integer;  tileSpace: Integer;begin  tileSpace := 32;  maxColumn := BGLVirtualScreen1.Width div tileSpace;  maxRow := BGLVirtualScreen1.Height div tileSpace;  p := 0;  r := 0;  grad := TBGRAMultiGradient.Create([CSSIndianRed, CSSMidnightBlue, CSSDarkKhaki],       [0, 0.5, 1], False, False);  try    for i := 0 to maxColumn do      begin        r := r + 1;      for j := 0 to maxRow do          begin            p := p + TrackBar2.Position;            x := i * tileSpace;            y := j * tileSpace;             rs := sin((p + r + ct * (PI / 180) * TrackBar3.Position)); // speed            sx := TrackBar1.Position * rs;            sy := TrackBar1.Position * rs;             sx := abs(sx);            sy := abs(sy);             x :=   round(x + (0 - sx) / 2);            y :=   round(y + (0 - sy) / 2);             case shape_type of              2: BGLContext.Canvas.Arc(x, y, sx / 3, sy / 3, 0, 360, grad.GetColorAtF((i + j) / (maxColumn + maxRow)), True, grad.GetColorAtF((i + j) / (maxColumn + maxRow)));            else            BGLContext.Canvas.FillRect(x, y, x + sx, y + sy, grad.GetColorAtF((i + j) / (maxColumn + maxRow)));            end;        end;      end;  finally    grad.Free;  end;end;And i switched to a case statement to choose the effect, it might ease the process to add more different shapes. ---------------------------------------------------------------------- TRon · 2024-04-15 18:34 Ah, I seem to have created the wrong scheme when using Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i     cc := round((j + i) / (TILES_COLCOUNT + TILES_ROWCOUNT) * 256);    col := cc shl 16 + cc shl 8 + 255; Oh, well  BTW, if you want the fx to be more realistic you can use: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   Bar(x,y,x+TILES_SQUARESIZE,y+TILES_SQUARESIZE); ---------------------------------------------------------------------- KodeZwerg · 2024-04-15 20:09 Here as project and to show just code, some more styles added: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.BGLVirtualScreen1Redraw(Sender: TObject;   BGLContext: TBGLContext);var  i, j, p, r, x, y : Integer;  rs, sx, sy : Double;  grad: TBGRACustomGradient;  maxColumn, maxRow: Integer;  tileSpace: Integer;begin  tileSpace := SpinEdit1.Value;  maxColumn := BGLVirtualScreen1.Width div tileSpace;  maxRow := BGLVirtualScreen1.Height div tileSpace;  p := 0;  r := 0;  grad := TBGRAMultiGradient.Create([CSSIndianRed, CSSMidnightBlue, CSSDarkKhaki],       [0, 0.5, 1], False, False);  try    for i := 0 to maxColumn do      begin        r := r + 1;        for j := 0 to maxRow do          begin            p := p + TrackBar2.Position;            x := i * tileSpace;            y := j * tileSpace;             rs := Sin((p + r + ct * (PI / 180) * TrackBar3.Position)); // speed          sx := TrackBar1.Position * rs;            sy := TrackBar1.Position * rs;             sx := Abs(sx);            sy := Abs(sy);             x := Round(x + (0 - sx) / 2);            y := Round(y + (0 - sy) / 2);             case shape_type of              1: BGLContext.Canvas.FillRect(x, y, x + sx, y + sy, grad.GetColorAtF((i + j) / (maxColumn + maxRow)));              2: BGLContext.Canvas.Arc(x, y, sx / 2, sy / 2, 0, 360, grad.GetColorAtF((i + j) / (maxColumn + maxRow)), True, grad.GetColorAtF((i + j) / (maxColumn + maxRow)));            3: BGLContext.Canvas.Ellipse(x, y, sx / 2, sy / 2, grad.GetColorAtF((i + j) / (maxColumn + maxRow)));              4: BGLContext.Canvas.Pie(x, y, sx / 2, sy / 2, 0, rs, grad.GetColorAtF((i + j) / (maxColumn + maxRow)), grad.GetColorAtF((i + j) / (maxColumn + maxRow)));              5: BGLContext.Canvas.FillRoundRect(x, y, x + i, y + i, sx, sy, grad.GetColorAtF((i + j) / (maxColumn + maxRow)), [], True);              6: BGLContext.Canvas.Rectangle(x, y, x + i, y + i, grad.GetColorAtF((i + j) / (maxColumn + maxRow)));            else              BGLContext.Canvas.FillRect(x, y, x + sx, y + sy, grad.GetColorAtF((i + j) / (maxColumn + maxRow)));            end;        end;      end;  finally    grad.Free;  end;end;Some images to demonstrate different shapes added aswell ---------------------------------------------------------------------- Gigatron · 2024-04-15 21:09 Thank you all for the code and idea, Here is the compilation code of circular, Tron, KodeZwerg and me This projet is now finished , it's now near %98 of Skid Row dot flag fx; Thanks again for the contributors circular, Tron, KodeZwerg !! Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit Unit1; {$mode objfpc}{$H+} interface uses  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,  ComCtrls, StdCtrls, Spin, BGLVirtualScreen, BGRAOpenGL, BGRABitmap,  BGRABitmapTypes, uplaysound, BGRACanvas2D;  type   { TForm1 }     TForm1 = class(TForm)    BGLVirtualScreen1: TBGLVirtualScreen;    Button1: TButton;    Label1: TLabel;    Label2: TLabel;    playsound1: Tplaysound;    SpinEdit2: TSpinEdit;    Timer1: TTimer;    TrackBar1: TTrackBar;    TrackBar2: TTrackBar;    TrackBar3: TTrackBar;    procedure BGLVirtualScreen1Redraw(Sender: TObject; BGLContext: TBGLContext);    procedure Button1Click(Sender: TObject);    procedure FormCreate(Sender: TObject);    procedure Timer1Timer(Sender: TObject);     private     public    var    ct, tval: integer;    shape_type: integer;   end; var  Form1: TForm1;  implementation {$R *.lfm} uses BGRAGradientScanner; { TForm1 } procedure TForm1.FormCreate(Sender: TObject);begin end;  procedure TForm1.BGLVirtualScreen1Redraw(Sender: TObject;   BGLContext: TBGLContext);var   i,j,p,r,x,y :integer;   rs,sx,sy : double;   grad: TBGRACustomGradient;   tileSpace, maxColumn,  maxRow : Integer; begin    tileSpace := 32;   maxColumn := 14;   maxRow := 11;   p := 0;  r := 0;  grad := TBGRAMultiGradient.Create([RGBToColor(0,136,255 ), CSSBlue, RGBToColor(248,248,255 )],       [0, 0.4, 1], grPad);  try  for i := 0 to 14 do    begin        r := r + 1;      for j := 0 to 11 do       begin          p:= p + TrackBar2.Position;          x:= i * 32  ;          y:= j * 32  ;           rs := sin((p+r+ct*(PI/180)*TrackBar3.Position)); // speed          sx :=   (TrackBar1.Position*rs);          sy :=   (TrackBar1.Position*rs);         sx := abs(sx);          sy := abs(sy);           x:=   round(x +  (56-sx)/2);          y:=   round(y +  (64-sy)/2);         case shape_type of              1: BGLContext.Canvas.FillRect(x, y, x + sx, y + sy, grad.GetColorAtF((i + j) / (maxColumn + maxRow)));            2: BGLContext.Canvas.Arc(x, y, sx / 2, sy / 2, 0, 360, grad.GetColorAtF((i + j) / (maxColumn + maxRow)), True, grad.GetColorAtF((i + j) / (maxColumn + maxRow)));              3: BGLContext.Canvas.Ellipse(x, y, sx / 2, sy / 2, grad.GetColorAtF((i + j) / (maxColumn + maxRow)));              4: BGLContext.Canvas.Pie(x, y, sx / 2, sy / 2, 0, rs, grad.GetColorAtF((i + j) / (maxColumn + maxRow)), grad.GetColorAtF((i + j) / (maxColumn + maxRow)));            5: BGLContext.Canvas.FillRoundRect(x, y, x + i, y + i, sx, sy, grad.GetColorAtF((i + j) / (maxColumn + maxRow)), [], True);            6: BGLContext.Canvas.Rectangle(x, y, x + i, y + i, grad.GetColorAtF((i + j) / (maxColumn + maxRow)));            else            BGLContext.Canvas.FillRect(x, y, x + sx, y + sy, grad.GetColorAtF((i + j) / (maxColumn + maxRow)));            end;     end;  end;  finally  end;  grad.Free;end; procedure TForm1.Button1Click(Sender: TObject);begin  playsound1.Execute;end; procedure TForm1.Timer1Timer(Sender: TObject);begin    ct := ct +1;    Label1.caption := IntToStr(TrackBar2.Position);    shape_type := spinEdit2.Value;    BGLVirtualScreen1.Repaint; end; end. ---------------------------------------------------------------------- TRon · 2024-04-15 23:10 Quote from: Gigatron on April 15, 2024, 11:09:50 pmThis projet is now finished , it's now near %98 of Skid Row dot flag fx; I wonder what the 2% is about...  not that I specifically care about that 2% but the fact that the effect does not actually resembles the original from skidrow where the animation goes from outward to inward (not a single particular direction as it is now). ---------------------------------------------------------------------- circular · 2024-04-16 20:46 Quote from: Gigatron on April 15, 2024, 08:01:43 pmEdit : ** In fact I don't need to do anything, I just tested your example and it works perfectly Thank you very much You're very welcome  QuoteBy the way , you certainly know the Amiga Blitter.. Can you include it in BGRA? We take part of the image and copy it elsewhere, it looks like Drawpart image like in javascript. BGRABlit(x,y,x1,y1, dx,dy) I don't know about Amiga Blitter, but I understand your wish. Would it be with BGLCanvas or with a TBGRABitmap? There is TBGRABitmap.PutImagePart that would do that. Regards ---------------------------------------------------------------------- Gigatron · 2024-04-16 23:13 Quote from: TRon on April 16, 2024, 01:10:22 amQuote from: Gigatron on April 15, 2024, 11:09:50 pmThis projet is now finished , it's now near %98 of Skid Row dot flag fx; I wonder what the 2% is about...  not that I specifically care about that 2% but the fact that the effect does not actually resembles the original from skidrow where the animation goes from outward to inward (not a single particular direction as it is now). Yes you are right it's not exactly the same fx, however the original routine on amiga is not include math sinus formula but based on square bob image with copper gradient; I am lazy to improve this fx to 100% but to achiev it to 99% you can divide part left side and right side and reverse sinus timer to obtain the original fx to 99%. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit Unit1; {$mode objfpc}{$H+} interface uses  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,  ComCtrls, StdCtrls, Spin, BGLVirtualScreen, BGRAOpenGL, BGRABitmap,  BGRABitmapTypes, uplaysound, BGRACanvas2D;  type   { TForm1 }     TForm1 = class(TForm)    BGLVirtualScreen1: TBGLVirtualScreen;    Button1: TButton;    Label1: TLabel;    Label2: TLabel;    playsound1: Tplaysound;    SpinEdit2: TSpinEdit;    Timer1: TTimer;    TrackBar1: TTrackBar;    TrackBar2: TTrackBar;    TrackBar3: TTrackBar;    procedure BGLVirtualScreen1Redraw(Sender: TObject; BGLContext: TBGLContext);    procedure Button1Click(Sender: TObject);    procedure FormCreate(Sender: TObject);    procedure Timer1Timer(Sender: TObject);     private     public    var    ct,ctt, tval: integer;    shape_type: integer;   end; var  Form1: TForm1;  implementation {$R *.lfm} uses BGRAGradientScanner; { TForm1 } procedure TForm1.FormCreate(Sender: TObject);begin end;  procedure TForm1.BGLVirtualScreen1Redraw(Sender: TObject;   BGLContext: TBGLContext);var   i,j,p,r,x,y :integer;         // Right Side   ii,jj,pp,rr,xx,yy : integer ; // Left Side   rs,sx,sy : double;          // Right Side   rss,sxx,syy : double;         // Left Side   grad: TBGRACustomGradient;   tileSpace, maxColumn,  maxRow : Integer; begin   tileSpace := 32;   maxColumn := 14;   maxRow := 11;   p := 0;  r := 0;  rr :=0;  pp :=0;  grad := TBGRAMultiGradient.Create([RGBToColor(0,136,255 ), CSSBlue, RGBToColor(248,248,255 )],       [0, 0.4, 1], grPad);  try  for i := 0 to 14 do    begin        r := r + 1;      for j := 0 to 11 do       begin          p:= p + TrackBar2.Position;          x:= i * 32  ;        y:= j * 32  ;          rs :=  sin((p+r+ct*(PI/180)*TrackBar3.Position)); // speed  negate ct to reverse sinus          sx :=   (TrackBar1.Position*rs);          sy :=   (TrackBar1.Position*rs);          sx := abs(sx);          sy := abs(sy);          x:=   round(x +  (56-sx)/2);          y:=   round(y +  (64-sy)/2);         if(j>11-i) then begin           BGLContext.Canvas.FillRect(x, y, x + sx, y + sy, grad.GetColorAtF((i + j) / (maxColumn + maxRow)));           end;      end;    end;  // double the trouble to the left side patterns ;   for ii := 0 to 14 do    begin        rr := rr + 1;      for jj := 0 to 11 do       begin        pp:= pp + TrackBar2.Position;          xx:= ii * 32  ;          yy:= jj * 32  ;          rss := sin((pp+rr- ctt*(PI/180)*TrackBar3.Position)); // speed  negate ctt to reverse sinus          sxx :=   (TrackBar1.Position*rss);          syy :=   (TrackBar1.Position*rss);          sxx := abs(sxx);          syy := abs(syy);          xx:=   round(xx +  (56-sxx)/2);          yy:=   round(yy +  (64-syy)/2);         if(jj<13-ii) then begin           BGLContext.Canvas.FillRect(xx, yy, xx + sxx, yy + syy, grad.GetColorAtF((ii + jj) / (maxColumn + maxRow)));        end;      end;    end;   finally  end;  grad.Free;end; procedure TForm1.Button1Click(Sender: TObject);begin  playsound1.Execute;end; procedure TForm1.Timer1Timer(Sender: TObject);begin    ct := ct +1;    ctt := ctt +1;    Label1.caption := IntToStr(TrackBar2.Position);    shape_type := spinEdit2.Value;    BGLVirtualScreen1.Repaint; end; end. ---------------------------------------------------------------------- Gigatron · 2024-04-16 23:14 Quote from: circular on April 16, 2024, 10:46:58 pmQuote from: Gigatron on April 15, 2024, 08:01:43 pmEdit : ** In fact I don't need to do anything, I just tested your example and it works perfectly Thank you very much You're very welcome  QuoteBy the way , you certainly know the Amiga Blitter.. Can you include it in BGRA? We take part of the image and copy it elsewhere, it looks like Drawpart image like in javascript. BGRABlit(x,y,x1,y1, dx,dy) I don't know about Amiga Blitter, but I understand your wish. Would it be with BGLCanvas or with a TBGRABitmap? There is TBGRABitmap.PutImagePart that would do that. Regards Thank you , will try it asap to make something great ---------------------------------------------------------------------- KodeZwerg · 2024-04-17 01:47 Unlocked it more, added labels to write down values , added colorbuttons to choose gradient colors on the fly, added a preset box to choose my defaults for each different shapestyle (they mostly look same on any screensize), modified this and that. Project and a preview attached. Variable screensize can differ to variable results //edit re-uploaded with some more presets ---------------------------------------------------------------------- Gigatron · 2024-08-23 23:14 Hi, Today I worked on a string table to plot a point. For example  000000011000011 ; if have 0 then plot black color, or 1 plot red color ; So look the code and you will understand the principle; Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i 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);    procedure DotPlot();  private   public   end; var  Form1: TForm1;  message_bitmap,message_bitmap1,bm : TBGRABitmap;  message : Array[0..19] Of String =('2222222222222222222222222222222222222222222222222222222222222222',                                     '2222222222222222222222222222222222222222222222222222222222222222',                                   '2200000000000000000000000000000000000000000000000000000000000022',                                   '2200001111111111111100011111111111111000111111111111100000000022',                                   '2200001000000000000000000000001000000000100000000000100000000022',                                   '2200001000000000000000000000001000000000100000000000100000000022',                                   '2200001000000000000000000000001000000000100000000000100000000022',                                   '2200001000000000000000000000001000000000100000000000100000000022',                                   '2200001000000000000000000000001000000000100000000000100000000022',                                   '2200001000000000000000000000001000000000111111111111000000000022',                                   '2200001000011111111100000000001000000000100110000000000000000022',                                   '2200001000000000000100000000001000000000100001100000000000000022',                                   '2200001000000000000100000000001000000000100000010000000000000022',                                   '2200001000000000000100000000001000000000100000001100000000000022',                                   '2200001000000000000100000000001000000000100000000010000000000022',                                   '2200001000000000000100000000001000000000100000000001000000000022',                                   '2200001111111111111100000000001000000000100000000000100000000022',                                   '2200000000000000000000000000000000000000000000000000000000000022',                                   '2222222222222222222222222222222222222222222222222222222222222222',                                   '22222222222222222222222222222222222 22222222222222222222222222222');  pos_x,pos_y,x,y  : integer; ta,xapp,yapp : single; // dot plot    s,a,ag : single; implementation {$R *.lfm} { TForm1 } procedure TForm1.Timer1Timer(Sender: TObject);begin     BGRAVirtualScreen1.RedrawBitmap;end; procedure TForm1.FormCreate(Sender: TObject);begin     pos_x := 0;     pos_y := 0;     ta :=0;     xapp :=0;     yapp :=0;      message_bitmap := TBGRABitmap.Create(ClientWidth,ClientHeight,BGRABlack);     message_bitmap1 := TBGRABitmap.Create(ClientWidth,ClientHeight,BGRABlack); // buffer    // plot fx   s := 255/sqrt(3)*2/30;   a := 0.0;   // angle   ag := 0.0; end; procedure TForm1.BGRAVirtualScreen1Redraw(Sender: TObject; Bitmap: TBGRABitmap);begin     DotPlot();     Bitmap.PutImage(0,0,mess age_bitmap,dmDrawWithTransparency);end; procedure TForm1.DotPlot;var ii,jj : integer;  r,z,x1,x2,y1,y2 : single;begin    message_Bitmap1.FillRect(0,0,ClientWidth,ClientHeight,BGRA(10,10,10) ); // clear screen      for ii:=1 to 64 do      begin        for jj:=0 to High(message) do         begin            ta   := ta + 0.00004;         xapp := x  + 32 * sin(ta-jj*0.2);           yApp := y  + 4  * sin(tA-jj*0.1+ii/2) ;            r := (sqrt(ii*ii+jj*jj))+2;           z := 10*sin(r+a*0.6)/r*0.8;            x2 := -jj*cos(a*PI/180)-jj*sin(ag*PI/180);           y2 := ii*sin(a*PI/180)-jj*cos(ag*PI/180);            x1 :=  round(60+(y2-x2)*s*sqrt(3)/2);           y1 :=  round(120+z-(y2+x2)*s/2);           pos_x := round(x1+xApp)+ii*12;         pos_y := round(y1+yApp)+jj*12;     if(message[jj][ii]='1') then message_Bitmap1.FillRect(pos_x, pos_y,pos_x+3,pos_y+3,BGRA(255,0,0,255),dmSet)    else if     (message[jj][ii]='2') then message_Bitmap1.FillRect(pos_x, pos_y,pos_x+3,pos_y+3,BGRA(0,125,255,255),dmSet)    else       message _Bitmap1.FillRect(pos_x,pos_y,pos_x+3,pos_y+3,BGRA(255,255,255,255),dm Set);    end;   end;      ag := ag + 0.4;      message_bitmap.PutImage(0,0,message_bitmap1,dmSet); end; end.