Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Wie funktioniert TColorKeyAnimation? (https://www.delphipraxis.net/216793-wie-funktioniert-tcolorkeyanimation.html)

Peter-Pascal 3. Mär 2025 16:53

Wie funktioniert TColorKeyAnimation?
 
Liste der Anhänge anzeigen (Anzahl: 2)
Hallo,
es gibt zwei Key-Animationen bei Delphi.FMX ColorKey- und FloatKeyAnimation und beide bekomme ich nicht zum Laufen. Was mache ich falsch?
Im Anhang die ScreenShots meiner Einstellungen.
Vielen Dank.
Gruß Peter

jaenicke 11. Mär 2025 01:58

AW: Wie funktioniert TColorKeyAnimation?
 
Über Key setzt du Werte in Keys auf einen Zeitstrahl von 0.0 (Start) bis 1.0 (Ende). Duration gibt die gesamte Länge der Animation an. Hier ein Beispiel. Ich habe das mal in FormCreate gepackt und das TRectangle dynamisch erstellt, so dass es einfach so gehen sollte:
Delphi-Quellcode:
uses
  FMX.Ani, FMX.Objects;

procedure TForm286.FormCreate(Sender: TObject);
var
  Rectangle: TRectangle;
  ColorKeyAnimation1: TColorKeyAnimation;
  ColorKey1, ColorKey2, ColorKey3, ColorKey4: TColorKey;
begin
  Rectangle := TRectangle.Create(Self);
  Rectangle.Parent := Self;
  Rectangle.Width := 200;
  Rectangle.Height := 100;
  Rectangle.Position.X := 100;
  Rectangle.Position.Y := 100;
  Rectangle.Fill.Color := TAlphaColorRec.Red;

  ColorKeyAnimation1 := TColorKeyAnimation.Create(Self);
  ColorKeyAnimation1.Parent := Rectangle;
  ColorKeyAnimation1.PropertyName := 'Fill.Color';
  ColorKeyAnimation1.Duration := 3.0;
  ColorKeyAnimation1.Loop := True;

  ColorKey1 := ColorKeyAnimation1.Keys.Add as TColorKey;
  ColorKey1.Key := 0.0;
  ColorKey1.Value := TAlphaColorRec.Red;

  ColorKey2 := ColorKeyAnimation1.Keys.Add as TColorKey;
  ColorKey2.Key := 0.33;
  ColorKey2.Value := TAlphaColorRec.Green;

  ColorKey3 := ColorKeyAnimation1.Keys.Add as TColorKey;
  ColorKey3.Key := 0.67;
  ColorKey3.Value := TAlphaColorRec.Blue;

  ColorKey4 := ColorKeyAnimation1.Keys.Add as TColorKey;
  ColorKey4.Key := 1.0;
  ColorKey4.Value := TAlphaColorRec.Red;

  ColorKeyAnimation1.Start;
end;


Alle Zeitangaben in WEZ +1. Es ist jetzt 11:01 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz