Keyframe for transitioning between two or more colors.
More...
|
|
static bool | keyframe_fade_render_frame (keyframe_base_t *const p_keyframe, timestep_t time, color_rgb_t *p_color_out) |
| |
|
static void | keyframe_fade_render_init (keyframe_base_t *const p_keyframe, framerate_t framerate, color_rgb_t current_color) |
| |
|
static keyframe_base_t * | keyframe_fade_clone (keyframe_base_t const *const p_keyframe) |
| |
| static void | blend_colors (color_hsv_t const *p_a, color_hsv_t const *p_b, fade_axis_t axis, float ratio, color_hsv_t *p_out) |
| | Blends two HSV colors based on a ratio between a to b. More...
|
| |
| static void | cubic_bezier_calc (cubic_bezier_t const *const p_curve, float t, point_t *p_point) |
| | Calculates a point on a cubic bezier curve at interpolation index, t. More...
|
| |
| keyframe_base_t * | keyframe_fade_parse (char *p_str) |
| | Parses a command string into a Fade Keyframe. More...
|
| |
| keyframe_base_t * | keyframe_fade_ctor (keyframe_fade_t *p_fade) |
| | Initialize a Fade keyframe with the appropriate keyframe_base_t and state values. More...
|
| |
|
| static const keyframe_base_api_t | keyframe_fade_api |
| | Fade keyframe API function pointers. More...
|
| |
| static const keyframe_fade_t | keyframe_fade_init |
| | Default values for fade keyframe structs. More...
|
| |
| const cubic_bezier_t | cb_linear = { { 0.0f, 0.0f }, { 1.0f, 1.0f } } |
| | Control points for linear fade. More...
|
| |
| const cubic_bezier_t | cb_ease = { { 0.25f, 0.1f }, { 0.25f, 1.0f } } |
| | Control points for ease fade. More...
|
| |
| const cubic_bezier_t | cb_ease_in = { { 0.42f, 0.0f }, { 1.0f, 1.0f } } |
| | Control points for ease-in fade. More...
|
| |
| const cubic_bezier_t | cb_ease_out = { { 0.0f, 0.0f }, { 0.58f, 1.0f } } |
| | Control points for ease-out fade. More...
|
| |
| const cubic_bezier_t | cb_ease_in_out = { { 0.42f, 0.0f }, { 0.58f, 1.0f } } |
| | Control points for ease-in-out fade. More...
|
| |
| const cubic_bezier_t | cb_linear |
| | Control points for linear fade. More...
|
| |
| const cubic_bezier_t | cb_ease |
| | Control points for ease fade. More...
|
| |
| const cubic_bezier_t | cb_ease_in |
| | Control points for ease-in fade. More...
|
| |
| const cubic_bezier_t | cb_ease_out |
| | Control points for ease-out fade. More...
|
| |
| const cubic_bezier_t | cb_ease_in_out |
| | Control points for ease-in-out fade. More...
|
| |
Keyframe for transitioning between two or more colors.
◆ KEYFRAME_FADE_COLORS_MAX_LENGTH
Maximum number of colors that can be faded in one keyframe.
Input + 1 to allow current color to be pushed to the top.
◆ fade_axis_t
The color axes/channels to fade over.
| Enumerator |
|---|
| FADE_AXIS_NONE | No axis require fading.
|
| FADE_AXIS_HUE | Fade is needed for the Hue axis.
|
| FADE_AXIS_SAT | Fade is needed for the Saturation axis.
|
| FADE_AXIS_VAL | Fade if needed for the Value axis.
|
◆ fade_type_t
The type of fade to perform.
| Enumerator |
|---|
| FADE_TYPE_STEP | Colors are immediately transitioned.
|
| FADE_TYPE_CUBIC | The transition curve is applied between every pair of colors.
|
◆ blend_colors()
Blends two HSV colors based on a ratio between a to b.
- Parameters
-
| [in] | p_a | Pointer to color a (ratio = 0). |
| [in] | p_b | Pointer to color b (ratio = 1). |
| axis | The axes to blend across. |
| ratio | The ratio between color a and color b. |
| [out] | p_out | Pointer to store the blended color. |
◆ cubic_bezier_calc()
Calculates a point on a cubic bezier curve at interpolation index, t.
This function assumes start, \( P_0 \), and end, \( P_3 \), points of \( (0,0) \) and \( (1,1) \) respectively. The equation for the bezier curve is
\[
\vec{B}(t) = (1-t)^3 \vec{P}_0 + 3 (1-t)^2 t \vec{P}_1 + 3 (1-t) t^2 \vec{P}_2 + t^3 \vec{P}_3, \quad 0 \le t \le 1
\]
or simplified using the assumptions for \( P_0 \) and \( P_3 \)
\[
\vec{B}(t) = 3 (1-t)^2 t \vec{P}_1 + 3 (1-t) t^2 \vec{P}_2 + t^3, \quad 0 \le t \le 1
\]
- Parameters
-
| [in] | p_curve | Pointer to the bezier control points. |
| t | Interpolation index at which to calculate a point on the curve; 0 <= t <= 1. |
| [out] | p_point | Pointer to store the calculated point. |
◆ keyframe_fade_ctor()
Initialize a Fade keyframe with the appropriate keyframe_base_t and state values.
- Parameters
-
| [in] | p_fade | Pointer to the fade keyframe to construct, or NULL to allocate a new one. |
- Returns
- Pointer to the keyframe base portion of the fade keyframe.
◆ keyframe_fade_parse()
| keyframe_base_t * keyframe_fade_parse |
( |
char * |
p_str | ) |
|
Parses a command string into a Fade Keyframe.
- Parameters
-
| [in] | p_str | Pointer to the command string. |
- Returns
- Pointer to the parsed keyframe or NULL on error.
◆ cb_ease [1/2]
Control points for ease fade.
Quickly fades from the start value, then transitions slower to the end value.
◆ cb_ease [2/2]
Control points for ease fade.
Quickly fades from the start value, then transitions slower to the end value.
◆ cb_ease_in [1/2]
Control points for ease-in fade.
Slow fade at the start then quickly fades to the end value.
◆ cb_ease_in [2/2]
Control points for ease-in fade.
Slow fade at the start then quickly fades to the end value.
◆ cb_ease_in_out [1/2]
| const cubic_bezier_t cb_ease_in_out = { { 0.42f, 0.0f }, { 0.58f, 1.0f } } |
Control points for ease-in-out fade.
Quickly transitions from the start to the end; faster than normal ease.
◆ cb_ease_in_out [2/2]
Control points for ease-in-out fade.
Quickly transitions from the start to the end; faster than normal ease.
◆ cb_ease_out [1/2]
| const cubic_bezier_t cb_ease_out = { { 0.0f, 0.0f }, { 0.58f, 1.0f } } |
Control points for ease-out fade.
Quickly fades from the start value then slowly fades to the end value.
◆ cb_ease_out [2/2]
Control points for ease-out fade.
Quickly fades from the start value then slowly fades to the end value.
◆ cb_linear [1/2]
Control points for linear fade.
Fades linearly, in equal steps, between the start and end values.
◆ cb_linear [2/2]
Control points for linear fade.
Fades linearly, in equal steps, between the start and end values.
◆ keyframe_fade_api
Initial value:=
{
.render_frame = keyframe_fade_render_frame,
.render_init = keyframe_fade_render_init,
.clone = keyframe_fade_clone,
}
Fade keyframe API function pointers.
◆ keyframe_fade_init
Initial value:=
{
.args =
{
.colors_len = 0,
.push_current = false,
.curve = { { 0.0f, 0.0f }, { 1.0f, 1.0f } },
.period = 1
}
}
static const keyframe_base_api_t keyframe_fade_api
Fade keyframe API function pointers.
Definition: keyframe_fade.c:25
@ FADE_TYPE_CUBIC
The transition curve is applied between every pair of colors.
Definition: keyframe_fade.h:34
Default values for fade keyframe structs.