Gamedev Framework (gf) 1.2.0
A C++17 framework for 2D games
Easings.h
1/*
2 * Gamedev Framework (gf)
3 * Copyright (C) 2016-2022 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 "CoreApi.h"
27#include "Math.h"
28
29namespace gf {
30#ifndef DOXYGEN_SHOULD_SKIP_THIS
31inline namespace v1 {
32#endif
33
48 using Easing = float (*)(float);
49
50
236 class GF_CORE_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
Predefined easing functions.
Definition: Easings.h:236
static float expoInOut(float t)
Ease-In-Out flavor of expo easing.
static float cubicOut(float t)
Ease-Out flavor of cubic easing.
static float elasticIn(float t)
Ease-In flavor of elastic easing.
static float linear(float t)
Linear easing.
static float bounceInOut(float t)
Ease-Out-In flavor of bounce easing.
static float elasticOutIn(float t)
Ease-Out-In flavor of elastic easing.
static float quartOutIn(float t)
Ease-Out-In flavor of quart easing.
static float circOut(float t)
Ease-Out flavor of circ easing.
static float bounceOut(float t)
Ease-Out flavor of bounce easing.
static float quadOutIn(float t)
Ease-Out-In flavor of quad easing.
static float circInOut(float t)
Ease-In-Out flavor of circ easing.
static float quintOut(float t)
Ease-Out flavor of quint easing.
static float circOutIn(float t)
Ease-Out-In flavor of circ easing.
static float backOut(float t)
Ease-Out flavor of back easing.
static float quadIn(float t)
Ease-In flavor of quad easing.
static float quintIn(float t)
Ease-In flavor of quint easing.
static float quadInOut(float t)
Ease-In-Out flavor of quad easing.
Ease()=delete
Deleted constructor.
static float sineOut(float t)
Ease-Out flavor of sine easing.
static float sineInOut(float t)
Ease-In-Out flavor of sine easing.
static float expoIn(float t)
Ease-In flavor of expo easing.
static float cubicIn(float t)
Ease-In flavor of cubic easing.
static float expoOutIn(float t)
Ease-Out-In flavor of expo easing.
static float sineIn(float t)
Ease-In flavor of sine easing.
static float backInOut(float t)
Ease-In-Out flavor of back easing.
static float expoOut(float t)
Ease-Out flavor of expo easing.
static float bounceIn(float t)
Ease-In flavor of bounce easing.
static float elasticOut(float t)
Ease-Out flavor of elastic easing.
static float quadOut(float t)
Ease-Out flavor of quad easing.
static float quintOutIn(float t)
Ease-Out-In flavor of quint easing.
static float quartIn(float t)
Ease-In flavor of quart easing.
static float cubicOutIn(float t)
Ease-Out-In flavor of cubic easing.
static float backOutIn(float t)
Ease-Out-In flavor of back easing.
static float quartOut(float t)
Ease-Out flavor of quart easing.
static float cubicInOut(float t)
Ease-In-Out flavor of cubic easing.
static float smoother(float t)
Smoother easing.
static float elasticInOut(float t)
Ease-In-Out flavor of elastic easing.
static float quartInOut(float t)
Ease-In-Out flavor of quart easing.
static float smooth(float t)
Smooth easing.
static float backIn(float t)
Ease-In flavor of back easing.
static float circIn(float t)
Ease-In flavor of circ easing.
static float quintInOut(float t)
Ease-In-Out flavor of quint easing.
static float bounceOutIn(float t)
Ease-In-Out flavor of bounce easing.
static float sineOutIn(float t)
Ease-Out-In flavor of sine easing.
float(*)(float) Easing
An easing function.
Definition: Easings.h:48
The namespace for gf classes.