Recently my wife asked me to help with an urgent request: a simple animation for a family dinner presentation. It was to be the last slide of the night, to cheer everyone up.
She had two animated gifs, the first from Quentin Tarantino’s famous Pulp Fiction dance scene, and another of an unknown origin. The plan was to overlay the heads with pictures of her parents and their grand children, then add an upbeat soundtrack.
The first issue was, how to play an animated Gif in FMX. A StackOverflow answer led me to TGifPlayer. Playing the animated gif couldn’t be simpler, you associate the player with an image, load the gif from file, and instruct the player to play.
FGifPlayer := TGifPlayer.Create(Self); FGifPlayer.Image := imgGrandParents; FGifPlayer.LoadFromFile('Images\PulpFiction.gif'); FGifPlayer.Play;
Frames
I used two frames, one for each animated gif. On each frame the head of each person was overlayed ontop of an animated gif head:
Each frame had a timer to co-ordinate the rotation of the head, the code couldn’t be simpler, for example rotating the grand parents:
procedure TAhGongAhMaFrame.OnTick; const LastAngle=3; AhGongAngles: array[0..LastAngle] of integer = (15,0,-15,0); AhMaAngles: array[0..LastAngle] of integer = (15,0,-15,0); begin Inc(FCounter); if FCounter>LastAngle then FCounter:=0; imgAhGong.RotationAngle := AhGongAngles[FCounter]; imgAhMa.RotationAngle := AhMaAngles[FCounter]; end;
Finishing Up
I then recorded the animation with Obs and used Windows Movie Maker to add fading effects, and a sound track. Thanks to the excellent TGifPlayer, and FMX, this was a very simple and timely task.
The video does not work,
LikeLike
Hi Lelie, can you check your privacy settings perhaps? The video plays fine for me, and I just confirmed my friend can see it too. If you don’t mind me asking, which browser are you using?
LikeLike
Hi,
I am using Firefox, with ads blocker turned off.
LikeLike
The video stuck at “Loading…”
LikeLike
This is standard WordPress functionality though, so I’m not sure what the issue might be, it must be client/configuration related.
It’s working fine for me in FireFox, and Chrome, on Windows and Linux. I’ll try Mac next.
Thanks for the update, I’ll see if I can find what might be wrong.
Which version of FireFox are you using, and what Operating System?
LikeLike
72.0.1 (64-bit) on Win10 Pro
However, do not worry too much as i was able to watch it on my iPhone.
Nice job 😉
LikeLiked by 1 person