Open 3D Engine LyShine Gem API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
UiFlipbookAnimationComponent Class Reference

#include <UiFlipbookAnimationComponent.h>

Inherits AZ::Component, UiCanvasUpdateNotificationBus::Handler, UiFlipbookAnimationBus::Handler, UiInitializationBus::Handler, and UiSpriteSourceNotificationBus::Handler.

Public Member Functions

 AZ_COMPONENT (UiFlipbookAnimationComponent, LyShine::UiFlipbookAnimationComponentUuid)
 
void Activate () override
 
void Deactivate () override
 
void Update (float deltaTime) override
 
void InGamePostActivate () override
 
void Start () override
 
void Stop () override
 
bool IsPlaying () override
 
AZ::u32 GetStartFrame () override
 
void SetStartFrame (AZ::u32 startFrame) override
 
AZ::u32 GetEndFrame () override
 
void SetEndFrame (AZ::u32 endFrame) override
 
AZ::u32 GetCurrentFrame () override
 
void SetCurrentFrame (AZ::u32 currentFrame) override
 
AZ::u32 GetLoopStartFrame () override
 
void SetLoopStartFrame (AZ::u32 loopStartFrame) override
 
UiFlipbookAnimationInterface::LoopType GetLoopType () override
 
void SetLoopType (UiFlipbookAnimationInterface::LoopType loopType) override
 
float GetFramerate () override
 
void SetFramerate (float framerate) override
 
FramerateUnits GetFramerateUnit () override
 
void SetFramerateUnit (FramerateUnits framerateUnit) override
 
float GetStartDelay () override
 
void SetStartDelay (float startDelay) override
 
float GetLoopDelay () override
 
void SetLoopDelay (float loopDelay) override
 
float GetReverseDelay () override
 
void SetReverseDelay (float reverseDelay) override
 
bool GetIsAutoPlay () override
 
void SetIsAutoPlay (bool isAutoPlay) override
 
void OnSpriteSourceChanged () override
 

Static Public Member Functions

static void GetProvidedServices (AZ::ComponentDescriptor::DependencyArrayType &provided)
 
static void GetIncompatibleServices (AZ::ComponentDescriptor::DependencyArrayType &incompatible)
 
static void GetRequiredServices (AZ::ComponentDescriptor::DependencyArrayType &required)
 

Protected Member Functions

LyShine::AZu32ComboBoxVec PopulateIndexStringList () const
 Returns a string representation of the indices used to index sprite-sheet types.
 
LyShine::AZu32ComboBoxVec PopulateConstrainedIndexStringList () const
 Populates a list of enumerated frame values between the start and end frame range.
 
AZ::u32 GetMaxFrame () const
 Total number of cells within sprite-sheet.
 
bool FrameWithinRange (AZ::u32 frameValue)
 Ensures that the given frame value is valid for the associated sprite-sheet.
 
void OnStartFrameChange ()
 Updates correlated frame values when the start frame value changes.
 
void OnEndFrameChange ()
 Updates correlated frame values when the end frame value changes.
 
void OnFramerateUnitChange ()
 Converts the frame-rate value based on the new framerate unit.
 
bool IsPingPongLoopType () const
 Returns true if this is a PingPong loop type, false otherwise.
 
bool IsLoopingType () const
 Returns true if animation will loop, false otherwise.
 
float CalculateLoopDelay () const
 Returns the amount to delay the current (forward or reverse) loop sequence.
 
float CalculateFramerateAsSecondsPerFrame () const
 Returns the framerate in seconds-per-frame.
 

Static Protected Member Functions

static void Reflect (AZ::ReflectContext *context)
 

Protected Attributes

AZ::u32 m_startFrame = 0
 
AZ::u32 m_endFrame = 0
 Last frame of animation.
 
AZ::u32 m_loopStartFrame = 0
 Start frame for looped animations.
 
UiFlipbookAnimationInterface::LoopType m_loopType = UiFlipbookAnimationInterface::LoopType::None
 
float m_framerate = 0.0f
 Transition speed between frames (either in FPS or seconds to wait per frame).
 
float m_startDelay = 0.0f
 Number of seconds to wait before playing the flipbook (applied only once during playback).
 
float m_loopDelay = 0.0f
 Number of seconds to wait before playing the loop sequence.
 
float m_reverseDelay = 0.0f
 Number of seconds to wait before playing the reverse loop sequence (PingPong loop types)
 
bool m_isAutoPlay = true
 Whether the animation should automatically start playing.
 
FramerateUnits m_framerateUnit = FramerateUnits::FPS
 
AZ::u32 m_currentFrame = 0
 Units to use when defining framerate.
 
AZ::u32 m_prevFrame = 0
 Previous frame displayed - used to detect intro sequences in a loop.
 
float m_elapsedTime = 0.0f
 Used to determine passage of time for handling frame delay.
 
bool m_isPlaying = false
 True if the animation is playing, false otherwise.
 
AZ::s32 m_currentLoopDirection = 1
 Used for PingPong loop direction (positive/negative)
 
bool m_useStartDelay = false
 Keeps track of whether start delay applies or not.
 

Detailed Description

FlipbookAnimationComponent FlipbookAnimationComponent provides a way to create an animated sprite for a UI canvas using sprite-sheets (via the image component)

Member Data Documentation

◆ m_currentFrame

AZ::u32 UiFlipbookAnimationComponent::m_currentFrame = 0
protected

Units to use when defining framerate.

Current sprite-sheet frame/index displayed

◆ m_startFrame

AZ::u32 UiFlipbookAnimationComponent::m_startFrame = 0
protected

Start frame of animation. Can be different from "loop start" frame to allow animations to have an "intro" sequence.


The documentation for this class was generated from the following file: