neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
easing.hpp
Go to the documentation of this file.
1// easing.hpp
2/*
3 neogfx C++ App/Game Engine
4 Copyright (c) 2018, 2020 Leigh Johnston. All Rights Reserved.
5
6 This program is free software: you can redistribute it and / or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19/* TERMS OF USE - EASING EQUATIONS
20 * Open source under the BSD License.
21 * Copyright(c)2001 Robert Penner
22 * All rights reserved.
23 * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met :
24 * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
25 * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
26 * Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission.
27 *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
29 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35#pragma once
36
37#include <neogfx/neogfx.hpp>
39
40namespace neogfx
41{
42 template <typename T>
43 inline T ease_linear(T t)
44 {
45 return t;
46 }
47
48 template <typename T>
49 inline T ease_in_sine(T t)
50 {
51 return 1.0 - std::cos(t * math::half_pi<T>());
52 }
53
54 template <typename T>
55 inline T ease_out_sine(T t)
56 {
57 return 1.0 - ease_in_sine(1.0 - t);
58 }
59
60 template <typename T>
61 inline T ease_in_out_sine(T t)
62 {
63 return (t < 0.5 ? ease_in_sine(t * 2.0) : 1.0 + ease_out_sine((t - 0.5) * 2.0)) / 2.0;
64 }
65
66 template <typename T>
67 inline T ease_out_in_sine(T t)
68 {
69 return (t < 0.5 ? ease_out_sine(t * 2.0) : 1.0 + ease_in_sine((t - 0.5) * 2.0)) / 2.0;
70 }
71
72 template <typename T>
73 inline T ease_in_quad(T t)
74 {
75 return t * t;
76 }
77
78 template <typename T>
79 inline T ease_out_quad(T t)
80 {
81 return 1.0 - ease_in_quad(1.0 - t);
82 }
83
84 template <typename T>
85 inline T ease_in_out_quad(T t)
86 {
87 return (t < 0.5 ? ease_in_quad(t * 2.0) : 1.0 + ease_out_quad((t - 0.5) * 2.0)) / 2.0;
88 }
89
90 template <typename T>
91 inline T ease_out_in_quad(T t)
92 {
93 return (t < 0.5 ? ease_out_quad(t * 2.0) : 1.0 + ease_in_quad((t - 0.5) * 2.0)) / 2.0;
94 }
95
96 template <typename T>
97 inline T ease_in_cubic(T t)
98 {
99 return t * t * t;
100 }
101
102 template <typename T>
103 inline T ease_out_cubic(T t)
104 {
105 return 1.0 - ease_in_cubic(1.0 - t);
106 }
107
108 template <typename T>
109 inline T ease_in_out_cubic(T t)
110 {
111 return (t < 0.5 ? ease_in_cubic(t * 2.0) : 1.0 + ease_out_cubic((t - 0.5) * 2.0)) / 2.0;
112 }
113
114 template <typename T>
115 inline T ease_out_in_cubic(T t)
116 {
117 return (t < 0.5 ? ease_out_cubic(t * 2.0) : 1.0 + ease_in_cubic((t - 0.5) * 2.0)) / 2.0;
118 }
119
120 template <typename T>
121 inline T ease_in_quart(T t)
122 {
123 return t * t * t * t;
124 }
125
126 template <typename T>
127 inline T ease_out_quart(T t)
128 {
129 return 1.0 - ease_in_quart(1.0 - t);
130 }
131
132 template <typename T>
133 inline T ease_in_out_quart(T t)
134 {
135 return (t < 0.5 ? ease_in_quart(t * 2.0) : 1.0 + ease_out_quart((t - 0.5) * 2.0)) / 2.0;
136 }
137
138 template <typename T>
139 inline T ease_out_in_quart(T t)
140 {
141 return (t < 0.5 ? ease_out_quart(t * 2.0) : 1.0 + ease_in_quart((t - 0.5) * 2.0)) / 2.0;
142 }
143
144 template <typename T>
145 inline T ease_in_quint(T t)
146 {
147 return t * t * t * t * t;
148 }
149
150 template <typename T>
151 inline T ease_out_quint(T t)
152 {
153 return 1.0 - ease_in_quint(1.0 - t);
154 }
155
156 template <typename T>
157 inline T ease_in_out_quint(T t)
158 {
159 return (t < 0.5 ? ease_in_quint(t * 2.0) : 1.0 + ease_out_quint((t - 0.5) * 2.0)) / 2.0;
160 }
161
162 template <typename T>
163 inline T ease_out_in_quint(T t)
164 {
165 return (t < 0.5 ? ease_out_quint(t * 2.0) : 1.0 + ease_in_quint((t - 0.5) * 2.0)) / 2.0;
166 }
167
168 template <typename T>
169 inline T ease_in_expo(T t)
170 {
171 return std::pow(2.0, 10 * (t - 1.0));
172 }
173
174 template <typename T>
175 inline T ease_out_expo(T t)
176 {
177 return 1.0 - ease_in_expo(1.0 - t);
178 }
179
180 template <typename T>
181 inline T ease_in_out_expo(T t)
182 {
183 return (t < 0.5 ? ease_in_expo(t * 2.0) : 1.0 + ease_out_expo((t - 0.5) * 2.0)) / 2.0;
184 }
185
186 template <typename T>
187 inline T ease_out_in_expo(T t)
188 {
189 return (t < 0.5 ? ease_out_expo(t * 2.0) : 1.0 + ease_in_expo((t - 0.5) * 2.0)) / 2.0;
190 }
191
192 template <typename T>
193 inline T ease_in_circ(T t)
194 {
195 return 1.0 - std::sqrt(1.0 - t * t);
196 }
197
198 template <typename T>
199 inline T ease_out_circ(T t)
200 {
201 return 1.0 - ease_in_circ(1.0 - t);
202 }
203
204 template <typename T>
205 inline T ease_in_out_circ(T t)
206 {
207 return (t < 0.5 ? ease_in_circ(t * 2.0) : 1.0 + ease_out_circ((t - 0.5) * 2.0)) / 2.0;
208 }
209
210 template <typename T>
211 inline T ease_out_in_circ(T t)
212 {
213 return (t < 0.5 ? ease_out_circ(t * 2.0) : 1.0 + ease_in_circ((t - 0.5) * 2.0)) / 2.0;
214 }
215
216 template <typename T, typename Arg = T>
217 inline T ease_in_back(T t, Arg s = 1.70158)
218 {
219 return t * t * ((s + 1.0) * t - s);
220 }
221
222 template <typename T, typename Arg = T>
223 inline T ease_out_back(T t, T s = 1.70158)
224 {
225 return 1.0 - ease_in_back(1.0 - t, s);
226 }
227
228 template <typename T, typename Arg = T>
229 inline T ease_in_out_back(T t, Arg s = 1.70158)
230 {
231 return (t < 0.5 ? ease_in_back(t * 2.0, s) : 1.0 + ease_out_back((t - 0.5) * 2.0, s)) / 2.0;
232 }
233
234 template <typename T, typename Arg = T>
235 inline T ease_out_in_back(T t, Arg s = 1.70158)
236 {
237 return (t < 0.5 ? ease_out_back(t * 2.0, s) : 1.0 + ease_in_back((t - 0.5) * 2.0, s)) / 2.0;
238 }
239
240 template <typename T, typename Arg = T>
241 inline T ease_in_elastic(T t, Arg a = 0.5, Arg p = 0.25)
242 {
243 if (t == 0.0)
244 return 0;
245 else if (t == 1.0)
246 return 1.0;
247 T s;
248 if (a < 1.0)
249 {
250 a = 1.0;
251 s = p / 4.0;
252 }
253 else
254 s = p / (2 * pi<T>()) * std::asin(1.0 / a);
255 return -(a * std::pow(2.0, 10.0 * (t - 1.0)) * std::sin(((t - 1.0) - s) * (two_pi<T>()) / p));
256 }
257
258 template <typename T, typename Arg = T>
259 inline T ease_out_elastic(T t, Arg a = 0.5, Arg p = 0.25)
260 {
261 return 1.0 - ease_in_elastic(1.0 - t, a, p);
262 }
263
264 template <typename T, typename Arg = T>
265 inline T ease_in_out_elastic(T t, Arg a = 0.5, Arg p = 0.25)
266 {
267 return (t < 0.5 ? ease_in_elastic(t * 2.0, a, p) : 1.0 + ease_out_elastic((t - 0.5) * 2.0, a, p)) / 2.0;
268 }
269
270 template <typename T, typename Arg = T>
271 inline T ease_out_in_elastic(T t, Arg a = 0.5, Arg p = 0.25)
272 {
273 return (t < 0.5 ? ease_out_elastic(t * 2.0, a, p) : 1.0 + ease_in_elastic((t - 0.5) * 2.0, a, p)) / 2.0;
274 }
275
276 template <typename T>
277 inline T ease_out_bounce(T t)
278 {
279 if (t < (1.0 / 2.75))
280 {
281 return (7.5625 * t * t);
282 }
283 else if (t < (2.0 / 2.75))
284 {
285 t -= (1.5 / 2.75);
286 return (7.5625 * t * t + 0.75);
287 }
288 else if (t < (2.5 / 2.75))
289 {
290 t -= (2.25 / 2.75);
291 return (7.5625 * t * t + 0.9375);
292 }
293 else
294 {
295 t -= (2.625 / 2.75);
296 return (7.5625 * t * t + 0.984375);
297 }
298 }
299
300 template <typename T>
301 inline T ease_in_bounce(T t)
302 {
303 return 1.0 - ease_out_bounce(1.0 - t);
304 }
305
306 template <typename T>
307 inline T ease_in_out_bounce(T t)
308 {
309 return (t < 0.5 ? ease_in_bounce(t * 2.0) : 1.0 + ease_out_bounce((t - 0.5) * 2.0)) / 2.0;
310 }
311
312 template <typename T>
313 inline T ease_out_in_bounce(T t)
314 {
315 return (t < 0.5 ? ease_out_bounce(t * 2.0) : 1.0 + ease_in_bounce((t - 0.5) * 2.0)) / 2.0;
316 }
317
318 template <typename T>
319 inline T ease_zero(T)
320 {
321 return 0.0;
322 }
323
324 template <typename T>
325 inline T ease_one(T)
326 {
327 return 1.0;
328 }
329
330 enum class easing_class : uint32_t
331 {
332 Linear = 0x0000,
333 Quad = 0x0001,
334 Cubic = 0x0002,
335 Quart = 0x0003,
336 Quint = 0x0004,
337 Sine = 0x0005,
338 Expo = 0x0006,
339 Circ = 0x0007,
340 Elastic = 0x0008,
341 Back = 0x0009,
342 Bounce = 0x000A,
343 Zero = 0x000B,
344 One = 0x000C,
345 In = 0x0100,
346 Out = 0x0200,
347 Reverse = 0x0400,
348 InOut = In | Out,
349 OutIn = In | Out | Reverse,
350 Inverted = 0x0800,
351 Constant = 0x1000,
352 CLASS_MASK = 0x00FF,
353 DIRECTION_MASK = 0xFF00,
354 };
355
357 {
358 return static_cast<easing_class>(static_cast<uint32_t>(lhs) | static_cast<uint32_t>(rhs));
359 }
360
362 {
363 return static_cast<easing_class>(static_cast<uint32_t>(lhs) & static_cast<uint32_t>(rhs));
364 }
365
366 inline constexpr easing_class operator~(easing_class lhs)
367 {
368 return static_cast<easing_class>(~static_cast<uint32_t>(lhs));
369 }
370
371 enum class easing : std::uint32_t
372 {
373 Linear = static_cast<std::uint32_t>(easing_class::Linear),
374 InLinear = static_cast<std::uint32_t>(easing_class::Linear | easing_class::In),
375 OutLinear = static_cast<std::uint32_t>(easing_class::Linear | easing_class::Out),
376 InOutLinear = static_cast<std::uint32_t>(easing_class::Linear | easing_class::InOut),
377 OutInLinear = static_cast<std::uint32_t>(easing_class::Linear | easing_class::OutIn),
378 InQuad = static_cast<std::uint32_t>(easing_class::Quad | easing_class::In),
379 OutQuad = static_cast<std::uint32_t>(easing_class::Quad | easing_class::Out),
380 InOutQuad = static_cast<std::uint32_t>(easing_class::Quad | easing_class::InOut),
381 OutInQuad = static_cast<std::uint32_t>(easing_class::Quad | easing_class::OutIn),
382 InCubic = static_cast<std::uint32_t>(easing_class::Cubic | easing_class::In),
383 OutCubic = static_cast<std::uint32_t>(easing_class::Cubic | easing_class::Out),
384 InOutCubic = static_cast<std::uint32_t>(easing_class::Cubic | easing_class::InOut),
385 OutInCubic = static_cast<std::uint32_t>(easing_class::Cubic | easing_class::OutIn),
386 InQuart = static_cast<std::uint32_t>(easing_class::Quart | easing_class::In),
387 OutQuart = static_cast<std::uint32_t>(easing_class::Quart | easing_class::Out),
388 InOutQuart = static_cast<std::uint32_t>(easing_class::Quart | easing_class::InOut),
389 OutInQuart = static_cast<std::uint32_t>(easing_class::Quart | easing_class::OutIn),
390 InQuint = static_cast<std::uint32_t>(easing_class::Quint | easing_class::In),
391 OutQuint = static_cast<std::uint32_t>(easing_class::Quint | easing_class::Out),
392 InOutQuint = static_cast<std::uint32_t>(easing_class::Quint | easing_class::InOut),
393 OutInQuint = static_cast<std::uint32_t>(easing_class::Quint | easing_class::OutIn),
394 InSine = static_cast<std::uint32_t>(easing_class::Sine | easing_class::In),
395 OutSine = static_cast<std::uint32_t>(easing_class::Sine | easing_class::Out),
396 InOutSine = static_cast<std::uint32_t>(easing_class::Sine | easing_class::InOut),
397 OutInSine = static_cast<std::uint32_t>(easing_class::Sine | easing_class::OutIn),
398 InExpo = static_cast<std::uint32_t>(easing_class::Expo | easing_class::In),
399 OutExpo = static_cast<std::uint32_t>(easing_class::Expo | easing_class::Out),
400 InOutExpo = static_cast<std::uint32_t>(easing_class::Expo | easing_class::InOut),
401 OutInExpo = static_cast<std::uint32_t>(easing_class::Expo | easing_class::OutIn),
402 InCirc = static_cast<std::uint32_t>(easing_class::Circ | easing_class::In),
403 OutCirc = static_cast<std::uint32_t>(easing_class::Circ | easing_class::Out),
404 InOutCirc = static_cast<std::uint32_t>(easing_class::Circ | easing_class::InOut),
405 OutInCirc = static_cast<std::uint32_t>(easing_class::Circ | easing_class::OutIn),
406 InElastic = static_cast<std::uint32_t>(easing_class::Elastic | easing_class::In),
407 OutElastic = static_cast<std::uint32_t>(easing_class::Elastic | easing_class::Out),
408 InOutElastic = static_cast<std::uint32_t>(easing_class::Elastic | easing_class::InOut),
409 OutInElastic = static_cast<std::uint32_t>(easing_class::Elastic | easing_class::OutIn),
410 InBack = static_cast<std::uint32_t>(easing_class::Back | easing_class::In),
411 OutBack = static_cast<std::uint32_t>(easing_class::Back | easing_class::Out),
412 InOutBack = static_cast<std::uint32_t>(easing_class::Back | easing_class::InOut),
413 OutInBack = static_cast<std::uint32_t>(easing_class::Back | easing_class::OutIn),
414 InBounce = static_cast<std::uint32_t>(easing_class::Bounce | easing_class::In),
415 OutBounce = static_cast<std::uint32_t>(easing_class::Bounce | easing_class::Out),
416 InOutBounce = static_cast<std::uint32_t>(easing_class::Bounce | easing_class::InOut),
417 OutInBounce = static_cast<std::uint32_t>(easing_class::Bounce | easing_class::OutIn),
418 Zero = static_cast<std::uint32_t>(easing_class::Zero | easing_class::Constant),
419 One = static_cast<std::uint32_t>(easing_class::One | easing_class::Constant),
420 InvertedLinear = static_cast<std::uint32_t>(easing_class::Linear | easing_class::Inverted),
467 };
468
469 inline constexpr easing operator|(easing lhs, easing_class rhs)
470 {
471 return static_cast<easing>(static_cast<uint32_t>(lhs) | static_cast<uint32_t>(rhs));
472 }
473
474 inline constexpr easing operator&(easing lhs, easing_class rhs)
475 {
476 return static_cast<easing>(static_cast<uint32_t>(lhs) & static_cast<uint32_t>(rhs));
477 }
478
479 typedef std::optional<easing> optional_easing;
480
481 typedef std::array<easing, 43> standard_easings_t;
482
533
534 inline uint32_t standard_easing_index(easing aEasing)
535 {
536 // todo: optimize this; perhaps use polymorphic enum.
537 auto standardEasing = std::find(standard_easings().begin(), standard_easings().end(), aEasing);
538 if (standardEasing != standard_easings().end())
539 return static_cast<uint32_t>(std::distance(standard_easings().begin(), standardEasing));
541 }
542
543 template <typename T>
544 inline T ease(easing e, T t)
545 {
546 auto standard_result = [e, t]()
547 {
548 switch (e & ~(easing_class::Inverted))
549 {
550 case easing::Linear:
551 case easing::InLinear:
555 return ease_linear(t);
556 case easing::InQuad:
557 return ease_in_quad(t);
558 case easing::OutQuad:
559 return ease_out_quad(t);
561 return ease_in_out_quad(t);
563 return ease_out_in_quad(t);
564 case easing::InCubic:
565 return ease_in_cubic(t);
566 case easing::OutCubic:
567 return ease_out_cubic(t);
569 return ease_in_out_cubic(t);
571 return ease_out_in_cubic(t);
572 case easing::InQuart:
573 return ease_in_quart(t);
574 case easing::OutQuart:
575 return ease_out_quart(t);
577 return ease_in_out_quart(t);
579 return ease_out_in_quart(t);
580 case easing::InQuint:
581 return ease_in_quint(t);
582 case easing::OutQuint:
583 return ease_out_quint(t);
585 return ease_in_out_quint(t);
587 return ease_out_in_quint(t);
588 case easing::InSine:
589 return ease_in_sine(t);
590 case easing::OutSine:
591 return ease_out_sine(t);
593 return ease_in_out_sine(t);
595 return ease_out_in_sine(t);
596 case easing::InExpo:
597 return ease_in_expo(t);
598 case easing::OutExpo:
599 return ease_out_expo(t);
601 return ease_in_out_expo(t);
603 return ease_out_in_expo(t);
604 case easing::InCirc:
605 return ease_in_circ(t);
606 case easing::OutCirc:
607 return ease_out_circ(t);
609 return ease_in_out_circ(t);
611 return ease_out_in_circ(t);
613 return ease_in_elastic(t);
615 return ease_out_elastic(t);
617 return ease_in_out_elastic(t);
619 return ease_out_in_elastic(t);
620 case easing::InBack:
621 return ease_in_back(t);
622 case easing::OutBack:
623 return ease_out_back(t);
625 return ease_in_out_back(t);
627 return ease_out_in_back(t);
628 case easing::InBounce:
629 return ease_in_bounce(t);
631 return ease_out_bounce(t);
633 return ease_in_out_bounce(t);
635 return ease_out_in_bounce(t);
636 case easing::Zero:
637 return ease_zero(t);
638 case easing::One:
639 return ease_one(t);
640 default:
641 throw std::logic_error("neogfx::easing: unknown easing type");
642 }
643 };
644 auto result = standard_result();
646 result = 1.0 - result;
647 return result;
648 }
649
650 template <typename T>
651 inline T ease(easing_class in, easing_class out, T t)
652 {
653 return (t < 0.5 ? ease(static_cast<easing>(in | easing_class::In), t / 0,5) : 1.0 + ease(static_cast<easing>(out | easing_class::Out), (t - 0.5) / 0.5)) / 2.0;
654 }
655
656 template <typename T>
657 inline T ease(easing e1, easing e2, T t)
658 {
659 return (t < 0.5 ? ease(e1, t / 0.5) : 1.0 + ease(e2, (t - 0.5) / 0.5)) / 2.0;
660 }
661
662 template <typename T>
663 inline T ease(easing e1, easing e2, easing e3, easing e4, T t)
664 {
665 return (t < 0.25 ? ease(e1, t / 0.25) : t < 0.5 ? 1.0 + ease(e2, (t - 0.25) / 0.25) : t < 0.75 ? 2.0 + ease(e3, (t - 0.5) / 0.25) : 3.0 + ease(e4, (t - 0.75) / 0.25)) / 4.0;
666 }
667
668 template <typename T>
669 inline T ease(easing e, T t, T b, T c, T d)
670 {
671 return ease(e, t / d) * c + b;
672 }
673
674 template <typename T>
675 inline T partitioned_ease(easing e1, easing e2, T t, double w1 = 1.0, double w2 = 1.0)
676 {
677 auto const wTotal = w1 + w2;
678 return t < w1 / wTotal ? ease(e1, t / (w1 / wTotal)) : ease(e2, (t - (w1 / wTotal)) / (w2 / wTotal));
679 }
680
681 template <typename T>
682 inline T partitioned_ease(easing e1, easing e2, easing e3, easing e4, T t, double w1 = 1.0, double w2 = 1.0, double w3 = 1.0, double w4 = 1.0)
683 {
684 auto const wTotal = w1 + w2 + w3 + w4;
685 return t < w1 / wTotal ?
686 ease(e1, t / (w1 / wTotal)) :
687 t < (w1 + w2) / wTotal ?
688 ease(e2, (t - w1 / wTotal) / (w2 / wTotal)) :
689 t < (w1 + w2 + w3) / wTotal ?
690 ease(e3, (t - (w1 + w2) / wTotal) / (w3 / wTotal)) :
691 ease(e4, (t - (w1 + w2 + w3) / wTotal) / (w4 / wTotal));
692 }
693
694 inline std::string const& to_string(easing e)
695 {
696 static const std::unordered_map<easing, std::string> STRING_MAP =
697 { {
698 { easing::Linear, "Linear"s },
699 { easing::InLinear, "InLinear"s },
700 { easing::OutLinear, "OutLinear"s },
701 { easing::InOutLinear, "InOutLinear"s },
702 { easing::OutInLinear, "OutInLinear"s },
703 { easing::InQuad, "InQuad"s },
704 { easing::OutQuad, "OutQuad"s },
705 { easing::InOutQuad, "InOutQuad"s },
706 { easing::OutInQuad, "OutInQuad"s },
707 { easing::InCubic, "InCubic"s },
708 { easing::OutCubic, "OutCubic"s },
709 { easing::InOutCubic, "InOutCubic"s },
710 { easing::OutInCubic, "OutInCubic"s },
711 { easing::InQuart, "InQuart"s },
712 { easing::OutQuart, "OutQuart"s },
713 { easing::InOutQuart, "InOutQuart"s },
714 { easing::OutInQuart, "OutInQuart"s },
715 { easing::InQuint, "InQuint"s },
716 { easing::OutQuint, "OutQuint"s },
717 { easing::InOutQuint, "InOutQuint"s },
718 { easing::OutInQuint, "OutInQuint"s },
719 { easing::InSine, "InSine"s },
720 { easing::OutSine, "OutSine"s },
721 { easing::InOutSine, "InOutSine"s },
722 { easing::OutInSine, "OutInSine"s },
723 { easing::InExpo, "InExpo"s },
724 { easing::OutExpo, "OutExpo"s },
725 { easing::InOutExpo, "InOutExpo"s },
726 { easing::OutInExpo, "OutInExpo"s },
727 { easing::InCirc, "InCirc"s },
728 { easing::OutCirc, "OutCirc"s },
729 { easing::InOutCirc, "InOutCirc"s },
730 { easing::OutInCirc, "OutInCirc"s },
731 { easing::InElastic, "InElastic"s },
732 { easing::OutElastic, "OutElastic"s },
733 { easing::InOutElastic, "InOutElastic"s },
734 { easing::OutInElastic, "OutInElastic"s },
735 { easing::InBack, "InBack"s },
736 { easing::OutBack, "OutBack"s },
737 { easing::InOutBack, "InOutBack"s },
738 { easing::OutInBack, "OutInBack"s },
739 { easing::InBounce, "InBounce"s },
740 { easing::OutBounce, "OutBounce"s },
741 { easing::InOutBounce, "InOutBounce"s },
742 { easing::OutInBounce, "OutInBounce"s },
743 { easing::Zero, "Zero"s },
744 { easing::One, "One"s }
745 } };
746 auto s = STRING_MAP.find(e);
747 if (s != STRING_MAP.end())
748 return s->second;
749 throw std::logic_error("neogfx::to_string: unknown easing type");
750 }
751}
T ease_linear(T t)
Definition easing.hpp:43
T ease_out_cubic(T t)
Definition easing.hpp:103
T ease_zero(T)
Definition easing.hpp:319
T ease_out_in_expo(T t)
Definition easing.hpp:187
T ease_out_in_sine(T t)
Definition easing.hpp:67
T ease_in_expo(T t)
Definition easing.hpp:169
T ease_in_out_circ(T t)
Definition easing.hpp:205
T ease_out_circ(T t)
Definition easing.hpp:199
constexpr style_aspect operator&(style_aspect aLhs, style_aspect aRhs)
Definition i_style.hpp:60
T partitioned_ease(easing e1, easing e2, T t, double w1=1.0, double w2=1.0)
Definition easing.hpp:675
T ease_in_out_quart(T t)
Definition easing.hpp:133
T ease_in_circ(T t)
Definition easing.hpp:193
T ease_out_in_quint(T t)
Definition easing.hpp:163
audio_channel operator~(audio_channel lhs)
T ease_out_in_circ(T t)
Definition easing.hpp:211
basic_length< T > in(T aValue)
Definition units.hpp:732
T ease_out_elastic(T t, Arg a=0.5, Arg p=0.25)
Definition easing.hpp:259
T ease_one(T)
Definition easing.hpp:325
T ease_out_bounce(T t)
Definition easing.hpp:277
easing_class
Definition easing.hpp:331
T ease_in_out_quint(T t)
Definition easing.hpp:157
T ease_out_expo(T t)
Definition easing.hpp:175
std::array< easing, 43 > standard_easings_t
Definition easing.hpp:481
T ease_in_out_sine(T t)
Definition easing.hpp:61
T ease_in_quart(T t)
Definition easing.hpp:121
std::string to_string(note const &aNote)
T ease_in_out_quad(T t)
Definition easing.hpp:85
T ease_out_in_elastic(T t, Arg a=0.5, Arg p=0.25)
Definition easing.hpp:271
T ease_out_in_back(T t, Arg s=1.70158)
Definition easing.hpp:235
T ease_in_elastic(T t, Arg a=0.5, Arg p=0.25)
Definition easing.hpp:241
T ease_out_sine(T t)
Definition easing.hpp:55
T ease_out_in_quad(T t)
Definition easing.hpp:91
T ease_out_in_bounce(T t)
Definition easing.hpp:313
const standard_easings_t & standard_easings()
Definition easing.hpp:483
T ease_out_in_quart(T t)
Definition easing.hpp:139
T ease_in_out_cubic(T t)
Definition easing.hpp:109
T ease_in_back(T t, Arg s=1.70158)
Definition easing.hpp:217
T ease_in_quad(T t)
Definition easing.hpp:73
T ease_in_quint(T t)
Definition easing.hpp:145
T ease_in_out_expo(T t)
Definition easing.hpp:181
T ease_in_out_elastic(T t, Arg a=0.5, Arg p=0.25)
Definition easing.hpp:265
T ease_in_cubic(T t)
Definition easing.hpp:97
T ease(easing e, T t)
Definition easing.hpp:544
T ease_out_quart(T t)
Definition easing.hpp:127
T ease_in_sine(T t)
Definition easing.hpp:49
T ease_out_in_cubic(T t)
Definition easing.hpp:115
T ease_in_out_bounce(T t)
Definition easing.hpp:307
constexpr style_aspect operator|(style_aspect aLhs, style_aspect aRhs)
Definition i_style.hpp:55
uint32_t standard_easing_index(easing aEasing)
Definition easing.hpp:534
T ease_out_back(T t, T s=1.70158)
Definition easing.hpp:223
T ease_in_out_back(T t, Arg s=1.70158)
Definition easing.hpp:229
std::optional< easing > optional_easing
Definition easing.hpp:479
T ease_in_bounce(T t)
Definition easing.hpp:301
T ease_out_quint(T t)
Definition easing.hpp:151
T ease_out_quad(T t)
Definition easing.hpp:79
iterator_traits< it_type >::difference_type distance(const it_type first, const it_type last)
Definition plf_hive.h:107