ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
IEasyEaseAnimator.h
Go to the documentation of this file.
1/**
2 * @file IEasyEaseAnimator.h
3 * @brief Declares the IEasyEaseAnimator interface for defining animation behaviors.
4 *
5 * This file defines the IEasyEaseAnimator interface, which provides the foundational
6 * methods for managing animations with various interpolation methods and parameter updates.
7 *
8 * @author Coela Can't
9 * @date 22/12/2024
10 */
11
12#pragma once
13
14#include "KeyFrame.h" // Include for keyframe management.
15#include "../Utils/Math/Mathematics.h" // Include for mathematical utilities.
16#include "../Physics/Utils/DampedSpring.h" // Include for damped spring physics.
17#include "../Utils/Filter/RampFilter.h" // Include for ramp filtering utilities.
18
19/**
20 * @class IEasyEaseAnimator
21 * @brief Interface for defining animation behaviors with easing and interpolation.
22 *
23 * The IEasyEaseAnimator interface provides methods for managing animated parameters,
24 * supporting interpolation methods, damped spring constants, and parameter transitions.
25 */
27public:
28 /**
29 * @enum InterpolationMethod
30 * @brief Enumeration of interpolation methods for animations.
31 *
32 * Provides various interpolation techniques for smooth and dynamic transitions.
33 */
35 Cosine, ///< Smooth cosine interpolation.
36 Bounce, ///< Bouncy effect during interpolation.
37 Linear, ///< Straight linear interpolation.
38 Overshoot ///< Interpolation with overshooting behavior.
39 };
40
41 /**
42 * @brief Sets the spring and damping constants for a parameter.
43 *
44 * @param dictionaryValue The parameter's dictionary identifier.
45 * @param springConstant The spring constant to set.
46 * @param damping The damping constant to set.
47 */
48 virtual void SetConstants(uint16_t dictionaryValue, float springConstant, float damping) = 0;
49
50 /**
51 * @brief Retrieves the current value of a parameter.
52 *
53 * @param dictionaryValue The parameter's dictionary identifier.
54 * @return The current value of the parameter.
55 */
56 virtual float GetValue(uint16_t dictionaryValue) = 0;
57
58 /**
59 * @brief Retrieves the target value of a parameter.
60 *
61 * @param dictionaryValue The parameter's dictionary identifier.
62 * @return The target value of the parameter.
63 */
64 virtual float GetTarget(uint16_t dictionaryValue) = 0;
65
66 /**
67 * @brief Adds a new parameter to the animator.
68 *
69 * @param parameter A pointer to the parameter to animate.
70 * @param dictionaryValue The parameter's dictionary identifier.
71 * @param frames The number of frames for the transition.
72 * @param basis The initial basis value.
73 * @param goal The target goal value.
74 */
75 virtual void AddParameter(float* parameter, uint16_t dictionaryValue, uint16_t frames, float basis, float goal) = 0;
76
77 /**
78 * @brief Adds a single frame value to a parameter.
79 *
80 * @param dictionaryValue The parameter's dictionary identifier.
81 * @param value The frame value to add.
82 */
83 virtual void AddParameterFrame(uint16_t dictionaryValue, float value) = 0;
84
85 /**
86 * @brief Sets the interpolation method for a parameter.
87 *
88 * @param dictionaryValue The parameter's dictionary identifier.
89 * @param interpMethod The interpolation method to set.
90 */
91 virtual void SetInterpolationMethod(uint16_t dictionaryValue, InterpolationMethod interpMethod) = 0;
92
93 /**
94 * @brief Resets the animator to its initial state.
95 */
96 virtual void Reset() = 0;
97
98 /**
99 * @brief Applies the current animation values to the parameters.
100 */
101 virtual void SetParameters() = 0;
102
103 /**
104 * @brief Updates the animator, advancing all animations.
105 */
106 virtual void Update() = 0;
107};
Declares the KeyFrame class for representing individual animation keyframes.
Interface for defining animation behaviors with easing and interpolation.
virtual float GetTarget(uint16_t dictionaryValue)=0
Retrieves the target value of a parameter.
virtual void Update()=0
Updates the animator, advancing all animations.
virtual void Reset()=0
Resets the animator to its initial state.
virtual float GetValue(uint16_t dictionaryValue)=0
Retrieves the current value of a parameter.
InterpolationMethod
Enumeration of interpolation methods for animations.
@ Linear
Straight linear interpolation.
@ Cosine
Smooth cosine interpolation.
@ Bounce
Bouncy effect during interpolation.
@ Overshoot
Interpolation with overshooting behavior.
virtual void SetConstants(uint16_t dictionaryValue, float springConstant, float damping)=0
Sets the spring and damping constants for a parameter.
virtual void SetParameters()=0
Applies the current animation values to the parameters.
virtual void AddParameterFrame(uint16_t dictionaryValue, float value)=0
Adds a single frame value to a parameter.
virtual void SetInterpolationMethod(uint16_t dictionaryValue, InterpolationMethod interpMethod)=0
Sets the interpolation method for a parameter.
virtual void AddParameter(float *parameter, uint16_t dictionaryValue, uint16_t frames, float basis, float goal)=0
Adds a new parameter to the animator.