Animation

A run of pictures, each shown for its own length of time: a GIF, a sprite drawn frame by frame, two pictures that swap. Its frames are ordinary images of the design’s, in a list under its settings - add them one at a time, or hand over a GIF and it is taken apart for you, each frame becoming an image with the time the file gave it. Arduino export.

Group: Ready-made · Default size: the first frame’s · Style parts: Main

A dropped Animation with no frames: a small dashed box crossed through.
An Animation as it is dropped, before it has frames.
Animation settings: Frames, four frames battery-1.png to battery-4.png at 400 ms each, Add an image..., Add a GIF..., Every frame lasts, A new frame lasts 100 ms, Starts by itself.
Its frames, in its settings.
SettingDefaultWhat it does
FramesnoneThe list, in the order they play. Each row is a frame: its picture, how long it shows in milliseconds, and buttons to move it earlier or later or take it out. Every frame lasts sets them all at once. Under the list it says how long a run is and what the frames take in flash.
A new frame lasts100 msWhat a frame is given when it is added. A GIF’s frames keep the file’s own times.
Starts by itselfonOff, it waits on its resting frame for a Play frames action or a value that drives it.
Plays, TimesOver and overOr a number of times, after which it stops and sends Finished.
There and backoffTo the last frame, then back through them to the first: a run of four shows 1 2 3 4 3 2, and ends on 1.
When it has finishedStays where it endedOr shows its resting frame.
Resting frame1The frame it shows while it is stopped, and the one the canvas draws. Counted from 1.

An Animation is the size of its frames, as an Icon is the size of its icon: pull a handle and it goes back. Frames should all be one size - the Problems tab says when they are not - and a GIF’s always are.

Two things can be bound, on the Data tab. Playing starts and pauses it from a value that is on or off. Frame shown puts it on a frame by number, which makes an Animation that is not playing a picture with as many states as it has frames: a battery with five levels, a signal with four bars, a lamp that is one of three colours - one widget, and a variable that says which.

What a frame costs. Each is a whole picture: width × height × 2 bytes, or 3 with transparency. Sixty frames of 100 × 100 is 1.2 MB, which is most of a 4 MB board’s firmware. A GIF’s frames are kept in the firmware, where each is drawn straight from flash; one moved to the filesystem is read off it again every time it comes round. At most 300 frames are taken out of one GIF, and it says when there were more.

A GIF stays one thing in the designer. Its frames are one row of the list - the file’s name, which frames it is and how long they run - and one tile on the Assets tab, drawn as a stack, with a single Stored in and Colour format for all of them. Earlier and Later move the whole run, and the bin takes it out of the animation; the tile’s cross takes the frames out of the design, and out of any animation playing them. They are still images like any other underneath: click the row’s name, or Show each frame on the Assets tab, to give one frame a time of its own, swap it, or use it in an Image widget.

A GIF is taken apart in your browser - the file goes nowhere - and every frame is the whole picture as it stands at that moment, since the board draws one image at a time. On the board it is an ordinary image and a timer, so a frame’s time is the file’s own, and the same code runs on LVGL 8 and 9. Compiled, and not yet run on a board.

Example: a battery that fills

  1. On the Assets tab add the four pictures, battery-1.png to battery-4.png: a battery with one, two, three and four bars.
  2. Drag an Animation onto the screen. Under Frames choose each picture in turn from Add an image...; Add a GIF... takes a GIF apart instead.
  3. Type 400 beside Every frame lasts and press Set. The widget takes the frames’ size, 96 x 56.
  4. Drag a Label under it saying Charging, and press Preview: it plays over and over.
A battery outline with one green bar, and the word Charging under it.
On the canvas: the resting frame.
Preview: the same battery with all four bars green.
Playing in Preview.