Recent

Author Topic: Demo Scene Text Fx  (Read 3221 times)

Gigatron

  • Jr. Member
  • **
  • Posts: 76
  • Amiga Rulez !!
Re: Demo Scene Text Fx
« Reply #15 on: May 10, 2024, 04:57:51 pm »
So what is the result ? :)

Oh, it looks really cool!!!

This video needs to be added in #madewithinraylib on discord channel

https://discord.gg/raylib

Ok , let me just learn Raylib quickly i mean Faster than light ;  and improve the demo and then will post it to discord sure :)

Edit : Nice, do someting nice at 1500 times faster than light here ;

https://www.youtube.com/watch?v=qQUGzPRQhoM&t=42s


« Last Edit: May 10, 2024, 07:17:56 pm by Gigatron »
Sub Quantum Technology ! We are in a micro universe.

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2269
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Demo Scene Text Fx
« Reply #16 on: May 10, 2024, 06:34:00 pm »
https://discord.gg/raylib
I was very happy to read about Discord server but a little disappointed on arrival :D
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

Gigatron

  • Jr. Member
  • **
  • Posts: 76
  • Amiga Rulez !!
Re: Demo Scene Text Fx
« Reply #17 on: May 23, 2024, 07:03:04 pm »
Hi, just made another intro using BGRA component;


Raylib version is different : https://www.youtube.com/watch?v=dfoDfmjd1x8



Code: Pascal  [Select][+][-]
  1. unit Unit1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls,
  9.   BGRAVirtualScreen, BGRABitmap, BGRABitmapTypes, BGRACanvas2D, Math;
  10.  
  11. type
  12.  
  13.   { TForm1 }
  14.  
  15.   TForm1 = class(TForm)
  16.     BGRAVirtualScreen1: TBGRAVirtualScreen;
  17.     Timer1: TTimer;
  18.     procedure BGRAVirtualScreen1Redraw(Sender: TObject; Bitmap: TBGRABitmap);
  19.     procedure FormCreate(Sender: TObject);
  20.     procedure Timer1Timer(Sender: TObject);
  21.   private
  22.  
  23.   public
  24.   procedure drawStar(ctx: TBGRACanvas2D;cx, cy, spikes : integer; outerRadius, innerRadius, rotation : single;style : TBGRAPixel);
  25.    procedure reset;
  26.   end;
  27.  
  28. var
  29.   Form1: TForm1;
  30.   rt : double;
  31.   x_pos,y_pos : integer;
  32.  
  33.   // txt
  34.   x,y,i,j,g_timer,speed  : integer;  // general demo timer
  35.   tx: Array[0..12]  Of String =('+******************+',
  36.                                 '*    GIGATRON      *',
  37.                                 '*                  *',
  38.                                 '*PRESENTS TEXT FX#5*',
  39.                                 '*                  *',
  40.                                 '*  BGRA COMPONENT  *',
  41.                                 '*                  *',
  42.                                 '*@LAZARUS FPC RULEZ*',
  43.                                  '********************',
  44.                                 '*SFX : TDK         *',
  45.                                 '*FONT: DOUGHNUT    *',
  46.                                 '*CODE: GIGATRON    *',
  47.                                 '+******************+');
  48.   dest_y :Array[0..12]  Of integer;
  49.  
  50. implementation
  51.  
  52. {$R *.lfm}
  53.  
  54. { TForm1 }
  55.  
  56. procedure Tform1.DrawStar(ctx: TBGRACanvas2D; cx, cy, spikes: Integer; outerRadius, innerRadius, rotation: single;style : TBGRAPixel);
  57. var
  58.   rot, step, x, y: single;
  59.   i: Integer;
  60. begin
  61.   rot := Pi / 2 * 3 + rotation;
  62.   step := Pi / spikes;
  63.  
  64.   ctx.BeginPath;
  65.   x := cx + cos(rot) * outerRadius;
  66.   y := cy + sin(rot) * outerRadius;
  67.   ctx.MoveTo(x, y);
  68.  
  69.   for i := 0 to spikes - 1 do
  70.   begin
  71.     x := cx + cos(rot) * outerRadius;
  72.     y := cy + sin(rot) * outerRadius;
  73.     ctx.LineTo(x, y);
  74.     rot := rot + step;
  75.     x := cx + cos(rot) * innerRadius;
  76.     y := cy + sin(rot) * innerRadius;
  77.     ctx.LineTo(x, y);
  78.     rot := rot + step;
  79.   end;
  80.  
  81.   x := cx + cos(rot) * outerRadius;
  82.   y := cy + sin(rot) * outerRadius;
  83.   ctx.LineTo(x, y);
  84.   ctx.ClosePath;
  85.  
  86.   ctx.LineWidth := 50;
  87.   ctx.strokeStyle(style);
  88.   ctx.Stroke;
  89.   ctx.fillStyle ('rgba(0,0,0,0)');;
  90.   ctx.Fill;
  91. end;
  92.  
  93. procedure TForm1.FormCreate(Sender: TObject);
  94. begin
  95.   rt := 0.0;
  96.   x_pos :=160;
  97.   y_pos :=50;
  98.  
  99.      x:=10; y:=0; i :=0; j :=0; speed := 40; // speed of fx
  100.      for i:=0 to 12 do
  101.      begin
  102.      dest_y[i] := 800  ; // set ypos for each lines
  103.      end;
  104.      sleep(5000);
  105. end;
  106. procedure TForm1.BGRAVirtualScreen1Redraw(Sender: TObject; Bitmap: TBGRABitmap);
  107. var
  108.   ctx: TBGRACanvas2D;
  109. begin
  110.   ctx := Bitmap.Canvas2D;
  111.   bitmap.FontName:='AmigaDigital8';
  112.   bitmap.FontHeight := 40;
  113.   bitmap.FontAntialias := false;
  114.  
  115.   drawStar(ctx, x_pos+200,y_pos+210, 7, 110.0, 170.0, rt,BGRA(44,55,66));
  116.   drawStar(ctx, x_pos+210,y_pos+220, 7, 110.0, 170.0, rt,BGRA(66,77,88));
  117.   drawStar(ctx, x_pos+220,y_pos+225, 7, 110.0, 170.0, rt,BGRA(77,88,99));
  118.   /// Txt
  119.   for j := 0 to  Min((g_timer div speed), High(tx)) do
  120.   begin
  121.     if g_timer > (j * speed) then
  122.     begin
  123.       for i := 0 to 1 do
  124.       begin
  125.         Bitmap.TextOut(x , dest_y[j] + 6, tx[j], BGRA(68, 85, 102));
  126.         Bitmap.TextOut(x , dest_y[j],     tx[j], BGRA(255, 255, 255));
  127.         dest_y[j] := dest_y[j] - 8;
  128.         if dest_y[j] < (j * 32) then dest_y[j] := j * 32;
  129.       end;
  130.     end;
  131.   end;
  132. end;
  133.  
  134. procedure TForm1.Timer1Timer(Sender: TObject);
  135. begin
  136.          rt := rt + 0.02;
  137.          inc(g_timer);
  138.          if(g_timer>800) then
  139.          begin
  140.           g_timer :=0;
  141.           BGRAVirtualScreen1.Invalidate;
  142.           reset;
  143.         end;
  144.         BGRAVirtualScreen1.RedrawBitmap;
  145. end;
  146.  
  147. procedure TForm1.reset();
  148. begin
  149.     i:=0;
  150.     for i:=0 to 12 do
  151.      begin
  152.        dest_y[i] := 800  ;
  153.      end;
  154. end;
  155.  
  156. end.
  157.  


« Last Edit: May 23, 2024, 07:09:23 pm by Gigatron »
Sub Quantum Technology ! We are in a micro universe.

 

TinyPortal © 2005-2018