@@ -71,6 +71,20 @@ class NeoEase
71
71
}
72
72
}
73
73
74
+ static float QuadraticCenter (float unitValue)
75
+ {
76
+ unitValue *= 2 .0f ;
77
+ if (unitValue < 1 .0f )
78
+ {
79
+ return (-0 .5f * (unitValue * unitValue - 2 .0f ));
80
+ }
81
+ else
82
+ {
83
+ unitValue -= 1 .0f ;
84
+ return (0 .5f * (unitValue * unitValue + 1 .0f ));
85
+ }
86
+ }
87
+
74
88
static float CubicIn (float unitValue)
75
89
{
76
90
return (unitValue * unitValue * unitValue);
@@ -96,6 +110,13 @@ class NeoEase
96
110
}
97
111
}
98
112
113
+ static float CubicCenter (float unitValue)
114
+ {
115
+ unitValue *= 2 .0f ;
116
+ unitValue -= 1 .0f ;
117
+ return (0 .5f * (unitValue * unitValue * unitValue) + 1 );
118
+ }
119
+
99
120
static float QuarticIn (float unitValue)
100
121
{
101
122
return (unitValue * unitValue * unitValue * unitValue);
@@ -121,6 +142,20 @@ class NeoEase
121
142
}
122
143
}
123
144
145
+ static float QuarticCenter (float unitValue)
146
+ {
147
+ unitValue *= 2 .0f ;
148
+ unitValue -= 1 .0f ;
149
+ if (unitValue < 0 .0f )
150
+ {
151
+ return (-0 .5f * (unitValue * unitValue * unitValue * unitValue - 1 .0f ));
152
+ }
153
+ else
154
+ {
155
+ return (0 .5f * (unitValue * unitValue * unitValue * unitValue + 1 .0f ));
156
+ }
157
+ }
158
+
124
159
static float QuinticIn (float unitValue)
125
160
{
126
161
return (unitValue * unitValue * unitValue * unitValue * unitValue);
@@ -146,6 +181,13 @@ class NeoEase
146
181
}
147
182
}
148
183
184
+ static float QuinticCenter (float unitValue)
185
+ {
186
+ unitValue *= 2 .0f ;
187
+ unitValue -= 1 .0f ;
188
+ return (0 .5f * (unitValue * unitValue * unitValue * unitValue * unitValue + 1 .0f ));
189
+ }
190
+
149
191
static float SinusoidalIn (float unitValue)
150
192
{
151
193
return (-cos (unitValue * HALF_PI) + 1 .0f );
@@ -161,6 +203,19 @@ class NeoEase
161
203
return -0.5 * (cos (PI * unitValue) - 1 .0f );
162
204
}
163
205
206
+ static float SinusoidalCenter (float unitValue)
207
+ {
208
+ if (unitValue < 0 .5f )
209
+ {
210
+ return (0.5 * sin (PI * unitValue));
211
+ }
212
+ else
213
+ {
214
+ return (-0.5 * (cos (PI * (unitValue-0 .5f )) + 1 .0f ));
215
+ }
216
+
217
+ }
218
+
164
219
static float ExponentialIn (float unitValue)
165
220
{
166
221
return (pow (2 , 10 .0f * (unitValue - 1 .0f )));
@@ -185,6 +240,20 @@ class NeoEase
185
240
}
186
241
}
187
242
243
+ static float ExponentialCenter (float unitValue)
244
+ {
245
+ unitValue *= 2 .0f ;
246
+ if (unitValue < 1 .0f )
247
+ {
248
+ return (0 .5f * (-pow (2 , -10 .0f * unitValue) + 1 .0f ));
249
+ }
250
+ else
251
+ {
252
+ unitValue -= 2 .0f ;
253
+ return (0 .5f * (pow (2 , 10 .0f * unitValue) + 1 .0f ));
254
+ }
255
+ }
256
+
188
257
static float CircularIn (float unitValue)
189
258
{
190
259
if (unitValue == 1 .0f )
@@ -217,6 +286,25 @@ class NeoEase
217
286
}
218
287
}
219
288
289
+ static float CircularCenter (float unitValue)
290
+ {
291
+ unitValue *= 2 .0f ;
292
+ unitValue -= 1 .0f ;
293
+ if (unitValue == 0 .0f )
294
+ {
295
+ return 1 .0f ;
296
+ }
297
+ else if (unitValue < 0 .0f )
298
+ {
299
+ return (0 .5f * sqrt (1 .0f - unitValue * unitValue));
300
+ }
301
+ else
302
+ {
303
+ unitValue -= 2 .0f ;
304
+ return (-0 .5f * (sqrt (1 .0f - unitValue * unitValue) - 1 .0f ) + 0 .5f );
305
+ }
306
+ }
307
+
220
308
static float Gamma (float unitValue)
221
309
{
222
310
return pow (unitValue, 1 .0f / 0 .45f );
0 commit comments