Unravel Engine C++ Reference
Loading...
Searching...
No Matches
seq_math.cpp
Go to the documentation of this file.
1#include "seq_math.h"
2
3namespace seq
4{
5auto square(float x, int n) -> float
6{
7 for(int i = 0; i < n; i++)
8 {
9 x *= x;
10 }
11 return x;
12}
13
14auto flip(float x) -> float
15{
16 return 1.0f - x;
17}
18
19auto mix(float a, float b, float weight, float t) -> float
20{
21 const float mix = ((1.0f - weight) * a) + ((1.0f - weight) * b);
22 return mix * t;
23}
24
25auto crossfade(float a, float b, float t) -> float
26{
27 return ((1.0f - t) * a) + (t * b);
28}
29
30auto scale(float a, float t) -> float
31{
32 return a * t;
33}
34
35auto reverse_scale(float a, float t) -> float
36{
37 return a * (1.0f - t);
38}
39
40auto arch(float t) -> float
41{
42 return t * (1.0f - t);
43}
44
45} // namespace seq
entt::handle b
entt::handle a
float scale
Definition hub.cpp:25
Provides a sequence-based action management system for controlling and scheduling actions.
auto mix(float a, float b, float weight, float t) -> float
Mixes two values based on a weighted progress factor.
Definition seq_math.cpp:19
auto flip(float x) -> float
Flips a normalized value (1.0 becomes 0.0, 0.0 becomes 1.0).
Definition seq_math.cpp:14
auto crossfade(float a, float b, float t) -> float
Creates a crossfade effect between two values based on progress.
Definition seq_math.cpp:25
auto reverse_scale(float a, float t) -> float
Scales a value in reverse by a factor.
Definition seq_math.cpp:35
auto arch(float t) -> float
Computes an arch effect (parabolic curve) based on progress.
Definition seq_math.cpp:40
auto square(float x, int n) -> float
Computes the square of a number raised to a power.
Definition seq_math.cpp:5
float x