-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEasing.h
More file actions
143 lines (112 loc) · 2.66 KB
/
Copy pathEasing.h
File metadata and controls
143 lines (112 loc) · 2.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#pragma once
#include <cstdint>
#include "DekiMath.h"
// DLL export macro
#ifdef DEKI_EDITOR
#ifdef _WIN32
#ifdef DEKI_TWEEN_EXPORTS
#define DEKI_TWEEN_API __declspec(dllexport)
#else
#define DEKI_TWEEN_API __declspec(dllimport)
#endif
#else
#define DEKI_TWEEN_API
#endif
#else
#define DEKI_TWEEN_API
#endif
namespace deki {
/**
* @brief Easing function type: takes normalized progress t in [0,1],
* returns eased value.
*/
using EasingFunc = float (*)(float t);
/**
* @brief Easing types enum for serialization and editor selection
*/
enum class EaseType : uint8_t
{
Linear = 0,
// Sine
SineIn,
SineOut,
SineInOut,
// Quad
QuadIn,
QuadOut,
QuadInOut,
// Cubic
CubicIn,
CubicOut,
CubicInOut,
// Quart
QuartIn,
QuartOut,
QuartInOut,
// Quint
QuintIn,
QuintOut,
QuintInOut,
// Expo
ExpoIn,
ExpoOut,
ExpoInOut,
// Circ
CircIn,
CircOut,
CircInOut,
// Back (overshoots)
BackIn,
BackOut,
BackInOut,
// Elastic
ElasticIn,
ElasticOut,
ElasticInOut,
// Bounce
BounceIn,
BounceOut,
BounceInOut,
COUNT
};
/**
* @brief Easing function implementations
*/
namespace Ease {
DEKI_TWEEN_API float Linear(float t);
DEKI_TWEEN_API float SineIn(float t);
DEKI_TWEEN_API float SineOut(float t);
DEKI_TWEEN_API float SineInOut(float t);
DEKI_TWEEN_API float QuadIn(float t);
DEKI_TWEEN_API float QuadOut(float t);
DEKI_TWEEN_API float QuadInOut(float t);
DEKI_TWEEN_API float CubicIn(float t);
DEKI_TWEEN_API float CubicOut(float t);
DEKI_TWEEN_API float CubicInOut(float t);
DEKI_TWEEN_API float QuartIn(float t);
DEKI_TWEEN_API float QuartOut(float t);
DEKI_TWEEN_API float QuartInOut(float t);
DEKI_TWEEN_API float QuintIn(float t);
DEKI_TWEEN_API float QuintOut(float t);
DEKI_TWEEN_API float QuintInOut(float t);
DEKI_TWEEN_API float ExpoIn(float t);
DEKI_TWEEN_API float ExpoOut(float t);
DEKI_TWEEN_API float ExpoInOut(float t);
DEKI_TWEEN_API float CircIn(float t);
DEKI_TWEEN_API float CircOut(float t);
DEKI_TWEEN_API float CircInOut(float t);
DEKI_TWEEN_API float BackIn(float t);
DEKI_TWEEN_API float BackOut(float t);
DEKI_TWEEN_API float BackInOut(float t);
DEKI_TWEEN_API float ElasticIn(float t);
DEKI_TWEEN_API float ElasticOut(float t);
DEKI_TWEEN_API float ElasticInOut(float t);
DEKI_TWEEN_API float BounceIn(float t);
DEKI_TWEEN_API float BounceOut(float t);
DEKI_TWEEN_API float BounceInOut(float t);
/**
* @brief Get easing function by type enum
*/
DEKI_TWEEN_API EasingFunc GetFunction(EaseType type);
} // namespace Ease
} // namespace deki