delphi How to start FloatAnimation from styled component

838 views Asked by At

here is my style in delphi 10.1 :

enter image description here

I like to animate some FloatAnimation (FA_...) onShow (i have a procedure Show) and also when i click the buttons.

I didn't find a way to start the animation ? i tried this but it doesn't work obviously :

TFLoatAnimation(Lieu.StylesData['FA_Title']).start;

Any solution ? or should i have to change the structure of my style ?

Thank you.

1

There are 1 answers

0
alitrun On BEST ANSWER
procedure TForm1.Button1Click(Sender: TObject);
var
  StyleObject: TFmxObject;
  StyleAni: TFloatAnimation;
begin
  StyleObject := Label1.FindStyleResource('floatanimationstyle');
  if (StyleObject <> nil) and (StyleObject is TFloatAnimation) then
  begin
    StyleAni := TFloatAnimation(StyleObject);
    StyleAni.Duration := 0.9;
    StyleAni.StartValue := 0;
    StyleAni.StopValue := 1;
    StyleAni.Start;
  end;
end;