unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Forms, Graphics, ExtCtrls, BGRAFlashProgressBar;
type
{ TForm1 }
TForm1 = class(TForm)
BGRAFlashProgressBar1: TBGRAFlashProgressBar;
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.Timer1Timer(Sender: TObject);
var
HP: Integer;
ValRed, ValGreen, ValBlue: Byte;
begin
HP := BGRAFlashProgressBar1.Value;
if HP > 0 then
Dec(HP)
else
HP := BGRAFlashProgressBar1.MaxValue;
BGRAFlashProgressBar1.Value := HP;
ValRed := Round((1 - HP/BGRAFlashProgressBar1.MaxValue) * 255);
ValGreen := Round(HP / BGRAFlashProgressBar1.MaxValue * 255);
ValBlue := Round(255 - abs(ValRed-ValGreen));
BGRAFlashProgressBar1.Color := RGBToColor(ValRed, ValGreen, ValBlue);
end;
end.