Aurore
A Switch-like interface for your app, on every screen
Loading...
Searching...
No Matches
aurore::Animatable Class Reference

#include <aurore/core/animation.hpp>

Inheritance diagram for aurore::Animatable:
aurore::FiniteTicking aurore::Ticking

Public Member Functions

 Animatable (float value=0.0f)
 
float getValue ()
 
void reset (float initialValue)
 
void reset ()
 
void addStep (float targetValue, int32_t duration, EasingFunction easing=EasingFunction::linear)
 
float getProgress ()
 
 operator float () const
 
 operator float ()
 
void operator= (const float value)
 
bool operator== (const float value)
 
- Public Member Functions inherited from aurore::FiniteTicking
void rewind ()
 
void reset ()
 
- Public Member Functions inherited from aurore::Ticking
virtual ~Ticking ()
 
void start ()
 
void stop ()
 
void setEndCallback (TickingEndCallback endCallback)
 
void setTickCallback (TickingTickCallback tickCallback)
 
bool isRunning ()
 

Protected Member Functions

bool onUpdate (Time delta) override
 
void onReset () override
 
void onRewind () override
 
- Protected Member Functions inherited from aurore::Ticking
virtual void onStart ()
 
virtual void onStop ()
 

Additional Inherited Members

- Static Public Member Functions inherited from aurore::Ticking
static void updateTickings ()
 
- Static Public Attributes inherited from aurore::Ticking
static std::vector< Ticking * > runningTickings
 

Constructor & Destructor Documentation

◆ Animatable()

aurore::Animatable::Animatable ( float  value = 0.0f)

Creates an animatable with the given initial value.

Member Function Documentation

◆ addStep()

void aurore::Animatable::addStep ( float  targetValue,
int32_t  duration,
EasingFunction  easing = EasingFunction::linear 
)

Adds an animation step to the target value, lasting the specified duration in milliseconds.

An animation can have multiple steps. Target value can be greater and lower than the previous step (it can go forwards or backwards). Easing function is optional, default is EasingFunction::linear.

Duration is int32_t due to internal limitations, so a step cannot last for longer than 2 147 483 647ms. The sum of the duration of all steps cannot exceed 71582min.

◆ getProgress()

float aurore::Animatable::getProgress ( )

Returns the progress of the animation between 0.0f and 1.0f.

◆ getValue()

float aurore::Animatable::getValue ( )

Returns the current animatable value.

◆ onReset()

void aurore::Animatable::onReset ( )
overrideprotectedvirtual

Called when the ticking gets reset.

Reimplemented from aurore::FiniteTicking.

◆ onRewind()

void aurore::Animatable::onRewind ( )
overrideprotectedvirtual

Called when the ticking gets rewound.

Reimplemented from aurore::FiniteTicking.

◆ onUpdate()

bool aurore::Animatable::onUpdate ( Time  delta)
overrideprotectedvirtual

Executed every frame while the ticking lives. Delta is the time difference in ms between the last frame and the current one. Must return false if the ticking is finished and should be removed from the list of active tickings. The end callback will automatically be called then.

Implements aurore::Ticking.

◆ operator float() [1/2]

aurore::Animatable::operator float ( )

◆ operator float() [2/2]

aurore::Animatable::operator float ( ) const

◆ operator=()

void aurore::Animatable::operator= ( const float  value)

◆ operator==()

bool aurore::Animatable::operator== ( const float  value)

◆ reset() [1/2]

void aurore::Animatable::reset ( )

Stops and resets the animation. The value will stay where it's at. All steps are removed. If an animation was already ongoing for that animatable, its end callback will be called.

◆ reset() [2/2]

void aurore::Animatable::reset ( float  initialValue)

Stops and resets the animation, going back to the given initial value. All steps are removed. If an animation was already ongoing for that animatable, its end callback will be called.


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