BlendAnimationInterface Class Reference

#include <blend_animation.h>

Inheritance diagram for BlendAnimationInterface:

Detailed Description

This class allows to handle easy animations using one or more BlendTweenInterfaces with a given timer interval. The following example demonstrates how to use this class:

// create a new BlendAnimationRef.
BlendAnimationRef animBlend = AnimBlendClass().Create() iferr_return;
// add one tween to animate a vector data type from 1/2/3 to 10/100/1000.
BlendTweenRef tween1 = animBlend.AddTween(BlendFunctions::EaseOutBounce(), Data(Vector(1, 2, 3)), Data(Vector(10, 100, 1000)),
[](const BlendAnimationRef& anim, const BlendTweenRef& tween, ANIMBLENDSTATE state, const Data& tickValue)
{
DiagnosticOutput("Anim: @ @", state, tickValue);
}, nullptr) iferr_return;
// start the animation with a 50 milli seconds timer interval and a duration of 1 second.
animBlend.StartAnimation(Milliseconds(50), TimeValue(), Seconds(1.0)) iferr_return;
Vec3< Float, 1 > Vector
Definition: vector.h:56
#define DiagnosticOutput(formatString,...)
Definition: debugdiagnostics.h:176
ANIMBLENDSTATE
Parameter used in the ObservableAnimation of the BlendTweenInterface.
Definition: blend_animation.h:21
#define iferr_return
Definition: resultbase.h:1521
Definition: grammar.h:37

Public Member Functions

MAXON_METHOD Result< BlendTweenRef > AddTween (const BlendFunctionRef &blendFunction, const Data &startValue, const Data &endValue)
 
MAXON_FUNCTION Result< BlendTweenRef > AddTween (const BlendFunctionRef &blendFunction, const Data &startValue, const Data &endValue, AnimBlendTweenCallback &&callback, const JobQueueRef &queue)
 
MAXON_METHOD Result< void > RemoveTween (const BlendTweenRef &tween)
 
MAXON_METHOD Result< BaseArray< BlendTweenRef > > GetTweens () const
 
MAXON_METHOD Result< void > StartAnimation (const TimeValue &timerInterval, const TimeValue &startDelay, const TimeValue &duration)
 
MAXON_METHOD Float GetProgress () const
 
MAXON_METHOD ANIMBLENDSTATE GetState () const
 
MAXON_METHOD void CancelAndWait ()
 
MAXON_METHOD Result< TimerRef > GetTimerRef () const
 
MAXON_METHOD void SetStartProgress (Float startProgress)
 
MAXON_METHOD void SetDirection (Bool reverse)
 

Static Public Member Functions

static Result< BlendAnimationRef > Create ()
 

Member Function Documentation

◆ Create()

static Result<BlendAnimationRef> Create ( )
static

Creates a new BlendAnimationRef object.

◆ AddTween() [1/2]

MAXON_METHOD Result<BlendTweenRef> AddTween ( const BlendFunctionRef &  blendFunction,
const Data startValue,
const Data endValue 
)

Adds an animation tween with the given function, start and end value.

◆ AddTween() [2/2]

MAXON_FUNCTION Result<BlendTweenRef> AddTween ( const BlendFunctionRef &  blendFunction,
const Data startValue,
const Data endValue,
AnimBlendTweenCallback &&  callback,
const JobQueueRef queue 
)

Adds an animation tween with the given function, start and end value. The callbacks are automatically mapped to the tween observable.

◆ RemoveTween()

MAXON_METHOD Result<void> RemoveTween ( const BlendTweenRef &  tween)

Returns an array with all tweens.

◆ GetTweens()

MAXON_METHOD Result<BaseArray<BlendTweenRef> > GetTweens ( ) const

Returns an array with all tweens.

◆ StartAnimation()

MAXON_METHOD Result<void> StartAnimation ( const TimeValue timerInterval,
const TimeValue startDelay,
const TimeValue duration 
)

Starts the animation with the given timer interval.

◆ GetProgress()

MAXON_METHOD Float GetProgress ( ) const

Returns a value between 0.0 and 1.0 with the current anim progress.

◆ GetState()

MAXON_METHOD ANIMBLENDSTATE GetState ( ) const

Returns the current state value.

◆ CancelAndWait()

MAXON_METHOD void CancelAndWait ( )

Kills the animation loop and the associated timer.

◆ GetTimerRef()

MAXON_METHOD Result<TimerRef> GetTimerRef ( ) const

Returns the timer used for this object.

◆ SetStartProgress()

MAXON_METHOD void SetStartProgress ( Float  startProgress)

SetStartProgress allows to set the progress where the animation should start. this can be useful if you try to reverse another animation.

Parameters
[in]startProgressStart value.

◆ SetDirection()

MAXON_METHOD void SetDirection ( Bool  reverse)

SetDirection allows to change the animation direction to play the reverse blend functions.

Parameters
[in]reverseTrue to animate backwards.