Class AnimatableObject
Defined in File AnimatableObject.h
Inheritance Relationships
Derived Type
public Segment
(Class Segment)
Class Documentation
-
class AnimatableObject
Base class which every object that can be animated by the Animator should inherit from.
Subclassed by Segment
Public Types
-
typedef void AnimationCallBack(void)
Callback typedef to use when an animation starts/finishes.
-
typedef void (*AnimationFunction)(CRGB *leds, uint16_t length, CRGB animationColor, uint16_t totalSteps, int32_t currentStep, bool invert)
Typedef for animation effect functions. These should be implemented explicitly for every object that inherits from AnimatableObject.
Public Functions
-
void setAnimationDoneCallback(AnimationCallBack *callback)
Set a callback to be executued once an animation has finished running.
- Parameters:
callback – function to call
-
void setAnimationStartCallback(AnimationCallBack *callback)
Set a callback to be executued once an animation is started.
- Parameters:
callback – function to call
Protected Functions
-
AnimatableObject()
-
AnimatableObject(uint16_t OverallDuration, uint16_t steps)
-
~AnimatableObject()
-
void setAnimationDuration(uint16_t duration)
Set the overall duration of any animation called on this object.
- Parameters:
duration – animation duration in ms
-
uint16_t getAnimationDuration()
Set the overall duration of any animation called on this object.
- Parameters:
duration – animation duration in ms
-
void setAnimationFps(uint16_t setAnimationFps)
Set the target Frames Per Second for any animation called on this object.
Note
This does not guarantee that the animation is actually running on that refresh rate. If it is set too fast the system will run it at the maximum possible framerate instead.
- Parameters:
setAnimationFps – how often the animation should be updated on the actual LEDs in Frames/Second
-
void start()
Enables an animation to run when #AnimatableObject::tick() gets called.
-
void stop()
Disables an animation to run when #AnimatableObject::tick() gets called but does not reset it’s current state. Could be thought of as “pausing” it.
-
void reset()
Stops (if not already done) and resets the animation to its starting point.
-
void handle(uint32_t state = -1)
Gets called by the Animator Animator::handle method when the animation is finished.
- Parameters:
state – if not -1 any animations currently running are going to be set to an exact state
-
virtual void setAnimationEffect(AnimatableObject::AnimationFunction newEffect)
Set the animation effect to the current object.
- Parameters:
newEffect – effect to execute the next time an animation is started on this object
-
virtual void setAnimationEasing(EasingBase *easingEffect)
Set the animation easing effect to the current object.
- Parameters:
easingEffect – effect to apply to the animation as an additional “modifier”
-
typedef void AnimationCallBack(void)