-
Notifications
You must be signed in to change notification settings - Fork 3
/
AnimationHelper.pas
43 lines (34 loc) · 1.17 KB
/
AnimationHelper.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
unit AnimationHelper;
interface
uses
FMX.Types, FMX.Controls, FMX.Objects, FMX.Skia, System.Classes;
type
TAnimationHelper = class
public
class procedure CreateAnimatedHeart(Data: TSkAnimatedImage;
Parent: TControl; OnFinish: TNotifyEvent = nil);
end;
implementation
class procedure TAnimationHelper.CreateAnimatedHeart(Data: TSkAnimatedImage;
Parent: TControl; OnFinish: TNotifyEvent = nil);
var
SkAniHeart: TSkAnimatedImage;
begin
SkAniHeart := TSkAnimatedImage.Create(Parent);
SkAniHeart.Align := TAlignLayout.Center;
SkAniHeart.Size.Width := 93;
SkAniHeart.Size.Height := 84;
SkAniHeart.Size.PlatformDefault := False;
SkAniHeart.Animation.Enabled := False;
SkAniHeart.Animation.Loop := False;
SkAniHeart.Animation.Speed := 3;
SkAniHeart.Parent := Parent;
// Configuração da imagem de animação (você pode ajustar isso de acordo com sua imagem)
SkAniHeart.Source := Data.Source;
// Evento OnFinish para lidar com a lógica quando a animação é concluída
if Assigned(OnFinish) then
SkAniHeart.OnAnimationFinish := OnFinish;
// Inicia a animação
SkAniHeart.Animation.Start;
end;
end.