Gamedev Framework (gf)  0.5.0
A C++11 framework for 2D games
Easings.h
1 /*
2  * Gamedev Framework (gf)
3  * Copyright (C) 2016-2017 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  * Part of this file comes from SFML, with the same license:
22  * Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
23  */
24 #ifndef GF_EASINGS_H
25 #define GF_EASINGS_H
26 
27 #include <cmath>
28 
29 #include "Math.h"
30 #include "Portability.h"
31 
32 namespace gf {
33 #ifndef DOXYGEN_SHOULD_SKIP_THIS
34 inline namespace v1 {
35 #endif
36 
51  using Easing = float (*)(float);
52 
53 
239  class GF_API Ease {
240  public:
241 
247  static float linear(float t);
248 
254  static float smooth(float t);
255 
261  static float smoother(float t);
262 
266  static float quadIn(float t);
267 
271  static float quadOut(float t);
272 
276  static float quadInOut(float t);
277 
281  static float quadOutIn(float t);
282 
286  static float cubicIn(float t);
287 
291  static float cubicOut(float t);
292 
296  static float cubicInOut(float t);
297 
301  static float cubicOutIn(float t);
302 
306  static float quartIn(float t);
307 
311  static float quartOut(float t);
312 
316  static float quartInOut(float t);
317 
321  static float quartOutIn(float t);
322 
326  static float quintIn(float t);
327 
331  static float quintOut(float t);
332 
336  static float quintInOut(float t);
337 
341  static float quintOutIn(float t);
342 
346  static float circIn(float t);
347 
351  static float circOut(float t);
352 
356  static float circInOut(float t);
357 
361  static float circOutIn(float t);
362 
366  static float sineIn(float t);
367 
371  static float sineOut(float t);
372 
376  static float sineInOut(float t);
377 
381  static float sineOutIn(float t);
382 
386  static float backIn(float t);
387 
391  static float backOut(float t);
392 
396  static float backInOut(float t);
397 
401  static float backOutIn(float t);
402 
406  static float bounceIn(float t);
407 
411  static float bounceOut(float t);
412 
416  static float bounceInOut(float t);
417 
421  static float bounceOutIn(float t);
422 
426  static float elasticIn(float t);
427 
431  static float elasticOut(float t);
432 
436  static float elasticInOut(float t);
437 
441  static float elasticOutIn(float t);
442 
446  static float expoIn(float t);
447 
451  static float expoOut(float t);
452 
456  static float expoInOut(float t);
457 
461  static float expoOutIn(float t);
462 
466  Ease() = delete;
467 
468  };
469 
470 #ifndef DOXYGEN_SHOULD_SKIP_THIS
471 }
472 #endif
473 }
474 
475 #endif // GF_EASINGS_H
The namespace for gf classes.
Definition: Action.h:34
Predefined easing functions.
Definition: Easings.h:239
float(*)(float) Easing
An easing function.
Definition: Easings.h:51