Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

GameAnimatedSprite

Plays a single sprite animation stored as a series of frames. More...

Import Statement: import Felgo 4.0
Inherits:

Item

Properties

Methods

Detailed Description

GameAnimatedSprite provides rendering and control over animations which are provided as multiple frames in the same image file. You can play it at a fixed speed, at the frame rate of your display, or manually advance and control the progress.

For full Qt documentation see AnimatedSprite and the Sprite Animations overview. Note that the GameAnimatedSprite type does not use Sprite types to define multiple animations, but instead encapsulates a single animation itself.

Felgo Additions to AnimatedSprite

GameAnimatedSprite enhances the Qt component AnimatedSprite with Content Scaling and Dynamic Image Switching Support & Density Independence.

Specifically, it allows you to:

  • Use the ideal image for memory and loading times based on the Felgo File Selectors.
  • Always has the same logical size for easy positioning in a Scene. This approach is also called Content Scaling.
  • Set the initial frameX or frameY with startFrameColumn or startFrameRow for simpler definitions.
  • The interpolate property is set to false by default, because at sprite animations interpolations usually looks blurry and should be deactivated by default.
  • Set the mirrorX and or mirrorY property.
  • The width & height properties are set automatically to frameWidth and frameHeight, respectively. If you explicitly define a width or height, the GameAnimatedSprite will be scaled to this size as it is done in GameAnimatedSprite. Thus existing Qt 5 GameAnimatedSprite code will work for GameAnimatedSprite, but the added convenience of GameAnimatedSprite cannot be applied back to normal GameAnimatedSprite components.

See the Felgo Script for Multi-Resolution Asset Generation how to create sprite sheets from single sprite frames and scale them down automatically.

Property Documentation

currentFrame : alias

See GameAnimatedSprite::currentFrame.


frameCount : alias

See GameAnimatedSprite::frameCount.


frameDuration : alias

See GameAnimatedSprite::frameDuration.


frameHeight : int

See GameAnimatedSprite::frameHeight.


frameRate : alias

See GameAnimatedSprite::frameRate.


frameSync : alias

See GameAnimatedSprite::frameSync.


frameWidth : int

See GameAnimatedSprite::frameWidth.


frameX : int

See GameAnimatedSprite::frameX.


frameY : int

See GameAnimatedSprite::frameY.


interpolate : alias

See GameAnimatedSprite::interpolate.


loops : alias

See GameAnimatedSprite::loops.


mirrorX : bool

This property holds whether the image should be horizontally mirrored.

Note: Mirroring on the horizontal axis is internally achieved by setting the Item::transform property. Thus if you set the transform property explicitly, you need to apply the y-scaling manually.

The default value is false.


mirrorY : bool

This property holds whether the image should be vertically mirrored.

Note: Mirroring on the verical axis is internally achieved by setting the Item::transform property. Thus if you set the transform property explicitly, you need to apply the y-scaling manually.

The default value is false.


paused : alias

See GameAnimatedSprite::paused.


reverse : alias

See GameAnimatedSprite::reverse.


running : alias

See GameAnimatedSprite::running.


source : alias

See GameAnimatedSprite::source.


startFrameColumn : int

An alternative to defining frameX, the left position of the first frame in the Sprite animation. If set, the frameX property is automatically calculated based on the column number by multiplying it with the frameWidth.

Note: The first colum (so the left-most frame) starts with column 1, not 0. The default value is 1.


startFrameRow : int

An alternative to defining frameY, the top position of the first frame in the Sprite animation. If set, the frameY property is automatically calculated based on the row number by multiplying it with the frameHeight.

Note: The first row (so the top-most frame) starts with row 1, not 0. The default value is 1.


Method Documentation

advance()

See GameAnimatedSprite::advance().


pause()

See GameAnimatedSprite::pause().


restart()

See GameAnimatedSprite::restart().


resume()

See GameAnimatedSprite::resume().


Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded