AnimatedSpriteDirectory QML Type

Draws a sprite animation stored in a directory. More...

Import Statement: import QtQuickUltralite.Extras 2.4
Since: Qt Quick Ultralite 2.4





Detailed Description

The AnimatedSpriteDirectory type behaves as AnimatedSprite, except that it gets the images for the sprite animation. It needs the sourcePath value to be the directory path that has a series of images. These images are the frames of a sprite animation, and the AnimatedSpriteDirectory plays each image as AnimatedSprite does.

The sequence of the animation frames follows the list order of the images in a ImageFiles node. Tag these image files with ImageFiles.MCU.resourceAnimatedSprite, to make sure the Qt Quick Ultralite Tools identify them as candidates for sprite animation frames. Tagging these images also enables identifying their directory name and rendering each image correctly.

QMLImage declaration in QML project
import QtQuickUltralite.Extras

AnimatedSpriteDirectory {
    sourcePath: "loading"
    ImageFiles {
        files: [
        MCU.resourceAnimatedSprite: true

Unlike AnimatedSprite, AnimatedSpriteDirectory does not have the frameCount, frameWidth, and frameHeight properties. It gets these values from the images in the given directory. The no. of images in the directory as the frameCount, width and height of those images as frameWidth and frameHeight respectively.

Note: All the images should have the same width and height, otherwise the resource compiler (qulrcc tool) cannot generate raw image data.

See also Managing resources.

Property Documentation

currentFrame : int

Set this property to advance the current frame manually, when the animation is not active. You could also call the advance() method.

frameDuration : int

Duration of each frame of the animation in milliseconds. Only positive values are valid.

Changing this property while the animation is active, will restart the animation.

loops : int

Indicates the no. of times the animation should replay. Only positive values are valid.

Set it to AnimatedSpriteDirectory.Infinite to play the animation infinitely.

Default is AnimatedSpriteDirectory.Infinite.

running : bool

Indicates whether the animation is playing or not.

Default is true.

sourcePath : string

Path to the directory with images for the sprite animation. Tag the images in the path by setting the ImageFiles.MCU.resourceAnimatedSprite property to true in the ImageFiles node.

Note: The given sourcePath is invalid if you don't tag the images.

Signal Documentation


This signal indicates that the sprite animation completed.

It is not emitted if you set either the running property to false or loops property to AnimatedSpriteDirectory.Infinite.

Note: The corresponding handler is onFinished.

Method Documentation


Advances the sprite animation by one frame.


Restarts the sprite animation.


Starts the sprite animation. If the animation is already running, calling this method has no effect.


Stops the sprite animation. If the animation is not running, calling this method has no effect.

Available under certain Qt licenses.
Find out more.