delphilottieskiadelphi-12-athensskia4delphi

How do you load a lottie file to TSkAnimdatedImage in FMX?


I want to show a lottie animation file in a TTSkAnimatedImage in FMX.

How do you load a lottie file to TSkAnimdatedImage in FMX?

With a normal TImage, I can simply load it with the MultiResBitmap or Bitmap , but not TSkAnimdatedImage.

But how for Lottie on TSkAnimdatedImage?


Solution

  • If you're doing it in design time:

    1. Add the TSkAnimatedImage to a form/frame.
    2. In the Object Inspector, there is the Source property when you select the placed TSkAnimatedImage component.
    3. Click the right '...' button, which opens a new window to load the Lottie file.

    Source property of TSkAnimatedImage

    If you're doing it in run time, you can use TSkAnimatedImage's methods LoadFromFile or LoadFromStream.

    It is well documented in the skia4delphi repository.