nomlib
Loading...
Searching...
No Matches
ActionTimingCurves.hpp
1/******************************************************************************
2
3 nomlib - C++11 cross-platform game engine
4
5Copyright (c) 2013, 2014 Jeffrey Carpenter <i8degrees@gmail.com>
6All rights reserved.
7
8Redistribution and use in source and binary forms, with or without
9modification, are permitted provided that the following conditions are met:
10
111. Redistributions of source code must retain the above copyright notice, this
12 list of conditions and the following disclaimer.
132. Redistributions in binary form must reproduce the above copyright notice,
14 this list of conditions and the following disclaimer in the documentation
15 and/or other materials provided with the distribution.
16
17THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
21ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28Easing algorithms are Copyright (c) 2001 Robert Penner
29
30******************************************************************************/
31#ifndef NOMLIB_ACTIONS_ACTION_TIMING_CURVES_HPP
32#define NOMLIB_ACTIONS_ACTION_TIMING_CURVES_HPP
33
34#include "nomlib/config.hpp"
35
36#include <functional>
37
38namespace nom {
39
40// Standard easing classes
41
45struct Linear
46{
54 static real32 ease_in(real32 t, real32 b, real32 c, real32 d);
55
63 static real32 ease_out(real32 t, real32 b, real32 c, real32 d);
64
72 static real32 ease_in_out(real32 t, real32 b, real32 c, real32 d);
73};
74
78struct Quad
79{
87 static real32 ease_in(real32 t, real32 b, real32 c, real32 d);
88
96 static real32 ease_out(real32 t, real32 b, real32 c, real32 d);
97
105 static real32 ease_in_out(real32 t, real32 b, real32 c, real32 d);
106};
107
111struct Cubic
112{
120 static real32 ease_in(real32 t, real32 b, real32 c, real32 d);
121
129 static real32 ease_out(real32 t, real32 b, real32 c, real32 d);
130
138 static real32 ease_in_out(real32 t, real32 b, real32 c, real32 d);
139};
140
144struct Quart
145{
153 static real32 ease_in(real32 t, real32 b, real32 c, real32 d);
154
162 static real32 ease_out(real32 t, real32 b, real32 c, real32 d);
163
171 static real32 ease_in_out(real32 t, real32 b, real32 c, real32 d);
172};
173
177struct Quint
178{
186 static real32 ease_in(real32 t, real32 b, real32 c, real32 d);
187
195 static real32 ease_out(real32 t, real32 b, real32 c, real32 d);
196
204 static real32 ease_in_out(real32 t, real32 b, real32 c, real32 d);
205};
206
207// Additional easing classes
208
209struct Back
210{
218 static real32 ease_in(real32 t, real32 b, real32 c, real32 d);
219
227 static real32 ease_out(real32 t, real32 b, real32 c, real32 d);
228
236 static real32 ease_in_out(real32 t, real32 b, real32 c, real32 d);
237};
238
239struct Bounce
240{
248 static real32 ease_in(real32 t, real32 b, real32 c, real32 d);
249
257 static real32 ease_out(real32 t, real32 b, real32 c, real32 d);
258
266 static real32 ease_in_out(real32 t, real32 b, real32 c, real32 d);
267};
268
269struct Circ
270{
278 static real32 ease_in(real32 t, real32 b, real32 c, real32 d);
279
287 static real32 ease_out(real32 t, real32 b, real32 c, real32 d);
288
296 static real32 ease_in_out(real32 t, real32 b, real32 c, real32 d);
297};
298
300{
308 static real32 ease_in(real32 t, real32 b, real32 c, real32 d);
309
317 static real32 ease_out(real32 t, real32 b, real32 c, real32 d);
318
326 static real32 ease_in_out(real32 t, real32 b, real32 c, real32 d);
327};
328
330struct Expo
331{
339 static real32 ease_in(real32 t, real32 b, real32 c, real32 d);
340
348 static real32 ease_out(real32 t, real32 b, real32 c, real32 d);
349
357 static real32 ease_in_out(real32 t, real32 b, real32 c, real32 d);
358};
359
360struct Sine
361{
369 static real32 ease_in(real32 t, real32 b, real32 c, real32 d);
370
378 static real32 ease_out(real32 t, real32 b, real32 c, real32 d);
379
387 static real32 ease_in_out(real32 t, real32 b, real32 c, real32 d);
388};
389
390std::function<real32(real32, real32, real32, real32)>
391make_timing_curve_from_string(const std::string& timing_mode);
392
393} // namespace nom
394
395#endif // include guard defined
396
static real32 ease_in_out(real32 t, real32 b, real32 c, real32 d)
static real32 ease_out(real32 t, real32 b, real32 c, real32 d)
static real32 ease_in(real32 t, real32 b, real32 c, real32 d)
static real32 ease_out(real32 t, real32 b, real32 c, real32 d)
static real32 ease_in(real32 t, real32 b, real32 c, real32 d)
static real32 ease_in_out(real32 t, real32 b, real32 c, real32 d)
static real32 ease_out(real32 t, real32 b, real32 c, real32 d)
static real32 ease_in(real32 t, real32 b, real32 c, real32 d)
static real32 ease_in_out(real32 t, real32 b, real32 c, real32 d)
The standard Cubic easing class.
static real32 ease_in(real32 t, real32 b, real32 c, real32 d)
static real32 ease_in_out(real32 t, real32 b, real32 c, real32 d)
static real32 ease_out(real32 t, real32 b, real32 c, real32 d)
static real32 ease_in(real32 t, real32 b, real32 c, real32 d)
static real32 ease_out(real32 t, real32 b, real32 c, real32 d)
static real32 ease_in_out(real32 t, real32 b, real32 c, real32 d)
static real32 ease_out(real32 t, real32 b, real32 c, real32 d)
static real32 ease_in(real32 t, real32 b, real32 c, real32 d)
static real32 ease_in_out(real32 t, real32 b, real32 c, real32 d)
The standard Linear easing class.
static real32 ease_in(real32 t, real32 b, real32 c, real32 d)
static real32 ease_in_out(real32 t, real32 b, real32 c, real32 d)
static real32 ease_out(real32 t, real32 b, real32 c, real32 d)
The standard Quad easing class.
static real32 ease_out(real32 t, real32 b, real32 c, real32 d)
static real32 ease_in(real32 t, real32 b, real32 c, real32 d)
static real32 ease_in_out(real32 t, real32 b, real32 c, real32 d)
The standard Quart easing class.
static real32 ease_in_out(real32 t, real32 b, real32 c, real32 d)
static real32 ease_out(real32 t, real32 b, real32 c, real32 d)
static real32 ease_in(real32 t, real32 b, real32 c, real32 d)
The standard Quint easing class – also known as "Strong".
static real32 ease_in(real32 t, real32 b, real32 c, real32 d)
static real32 ease_in_out(real32 t, real32 b, real32 c, real32 d)
static real32 ease_out(real32 t, real32 b, real32 c, real32 d)
static real32 ease_in_out(real32 t, real32 b, real32 c, real32 d)
static real32 ease_out(real32 t, real32 b, real32 c, real32 d)
static real32 ease_in(real32 t, real32 b, real32 c, real32 d)