Gamedev Framework (gf)  0.10.0
A C++14 framework for 2D games
Easings.h
1 /*
2  * Gamedev Framework (gf)
3  * Copyright (C) 2016-2018 Julien Bernard
4  *
5  * This software is provided 'as-is', without any express or implied
6  * warranty. In no event will the authors be held liable for any damages
7  * arising from the use of this software.
8  *
9  * Permission is granted to anyone to use this software for any purpose,
10  * including commercial applications, and to alter it and redistribute it
11  * freely, subject to the following restrictions:
12  *
13  * 1. The origin of this software must not be misrepresented; you must not
14  * claim that you wrote the original software. If you use this software
15  * in a product, an acknowledgment in the product documentation would be
16  * appreciated but is not required.
17  * 2. Altered source versions must be plainly marked as such, and must not be
18  * misrepresented as being the original software.
19  * 3. This notice may not be removed or altered from any source distribution.
20  */
21 #ifndef GF_EASINGS_H
22 #define GF_EASINGS_H
23 
24 #include <cmath>
25 
26 #include "Math.h"
27 #include "Portability.h"
28 
29 namespace gf {
30 #ifndef DOXYGEN_SHOULD_SKIP_THIS
31 inline namespace v1 {
32 #endif
33 
48  using Easing = float (*)(float);
49 
50 
236  class GF_API Ease {
237  public:
238 
244  static float linear(float t);
245 
251  static float smooth(float t);
252 
258  static float smoother(float t);
259 
263  static float quadIn(float t);
264 
268  static float quadOut(float t);
269 
273  static float quadInOut(float t);
274 
278  static float quadOutIn(float t);
279 
283  static float cubicIn(float t);
284 
288  static float cubicOut(float t);
289 
293  static float cubicInOut(float t);
294 
298  static float cubicOutIn(float t);
299 
303  static float quartIn(float t);
304 
308  static float quartOut(float t);
309 
313  static float quartInOut(float t);
314 
318  static float quartOutIn(float t);
319 
323  static float quintIn(float t);
324 
328  static float quintOut(float t);
329 
333  static float quintInOut(float t);
334 
338  static float quintOutIn(float t);
339 
343  static float circIn(float t);
344 
348  static float circOut(float t);
349 
353  static float circInOut(float t);
354 
358  static float circOutIn(float t);
359 
363  static float sineIn(float t);
364 
368  static float sineOut(float t);
369 
373  static float sineInOut(float t);
374 
378  static float sineOutIn(float t);
379 
383  static float backIn(float t);
384 
388  static float backOut(float t);
389 
393  static float backInOut(float t);
394 
398  static float backOutIn(float t);
399 
403  static float bounceIn(float t);
404 
408  static float bounceOut(float t);
409 
413  static float bounceInOut(float t);
414 
418  static float bounceOutIn(float t);
419 
423  static float elasticIn(float t);
424 
428  static float elasticOut(float t);
429 
433  static float elasticInOut(float t);
434 
438  static float elasticOutIn(float t);
439 
443  static float expoIn(float t);
444 
448  static float expoOut(float t);
449 
453  static float expoInOut(float t);
454 
458  static float expoOutIn(float t);
459 
463  Ease() = delete;
464 
465  };
466 
467 #ifndef DOXYGEN_SHOULD_SKIP_THIS
468 }
469 #endif
470 }
471 
472 #endif // GF_EASINGS_H
The namespace for gf classes.
Definition: Action.h:34
Predefined easing functions.
Definition: Easings.h:236
float(*)(float) Easing
An easing function.
Definition: Easings.h:48