2017-05-16 4 views
0

est mon style ici delphi 10.1:delphi Comment commencer FloatAnimation du composant Styled

enter image description here

J'aime animer une FloatAnimation (FA _...) onShow (j'ai une procédure Show) et aussi quand je clique sur les boutons.

Je n'ai pas trouvé un moyen de démarrer l'animation? j'ai essayé ceci mais cela ne fonctionne pas évidemment:

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

Une solution? ou devrais-je changer la structure de mon style?

Merci.

Répondre

1
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;