modm API documentation
modm::ui::KeyFrameAnimation< T, N > Class Template Reference

#include <modm/ui/animation/key_frame.hpp>

Public Member Functions

 KeyFrameAnimation (Animation< T >... &animator)
 The constructor requires references to all N animator objects.
 
 KeyFrameAnimation (KeyFrame< T, N > *frames, uint16_t length, Animation< T >... &animator)
 
bool start (uint8_t repeat=0)
 
void stop ()
 Stops the animation and sets the last frame of the cycle.
 
void cancel ()
 Stops the animation right now.
 
bool isAnimating () const
 
void update ()
 must be called regularly
 
KeyFrame< T, N > * getKeyFrames () const
 
uint16_t getCurrentKeyFrame () const
 
void setKeyFrames (KeyFrame< T, N > *frames, uint16_t length)
 
uint16_t getLength () const
 
KeyFrameAnimationMode const getMode () const
 
void setMode (KeyFrameAnimationMode const mode)
 

Detailed Description

template<typename T = uint8_t, uint8_t N = 1>
class modm::ui::KeyFrameAnimation< T, N >

This class takes an array of keyframes and applies them to an animation.

Author
Niklas Hauser

Constructor & Destructor Documentation

template<typename T = uint8_t, uint8_t N = 1>
modm::ui::KeyFrameAnimation< T, N >::KeyFrameAnimation ( KeyFrame< T, N > *  frames,
uint16_t  length,
Animation< T >... &  animator 
)
Parameters
framespointer to the keyframe array
lengththe number of keyframes in the array The constructor requires references to all N animator objects

Member Function Documentation

template<typename T = uint8_t, uint8_t N = 1>
uint16_t modm::ui::KeyFrameAnimation< T, N >::getCurrentKeyFrame ( ) const
Returns
get the currently animating key frame index, or 0
template<typename T = uint8_t, uint8_t N = 1>
KeyFrame<T, N>* modm::ui::KeyFrameAnimation< T, N >::getKeyFrames ( ) const
Returns
the pointer to the key frame array
template<typename T = uint8_t, uint8_t N = 1>
bool modm::ui::KeyFrameAnimation< T, N >::isAnimating ( ) const
Returns
true if animation is currently running, false if otherwise
template<typename T = uint8_t, uint8_t N = 1>
void modm::ui::KeyFrameAnimation< T, N >::setKeyFrames ( KeyFrame< T, N > *  frames,
uint16_t  length 
)
Parameters
framespointer to the keyframe array
lengththe number of keyframes in the array
template<typename T = uint8_t, uint8_t N = 1>
bool modm::ui::KeyFrameAnimation< T, N >::start ( uint8_t  repeat = 0)

start the keyframe animation

Parameters
repeatnumber of repeats of the entire animation, set to 0 for infinity
Returns
true if keyframes are valid and animation started, false otherwise

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