25#ifndef TWEENY_DETAIL_EASING_BACK_H
26#define TWEENY_DETAIL_EASING_BACK_H
28namespace tweeny::detail {
31 static T run(
float position, T start, T end) {
32 constexpr float s = 1.70158f;
33 float postFix = position;
34 return static_cast<T
>((end - start) * postFix * position * ((s + 1) * position - s) + start);
38 T operator()(
const float position, T start, T end)
const {
39 return run<T>(position, start, end);
43 struct backOutEasing {
45 static T run(
float position, T start, T end) {
46 constexpr float s = 1.70158f;
48 return static_cast<T
>((end - start) * ((position) * position * ((s + 1) * position + s) + 1) + start);
52 T operator()(
float position, T start, T end)
const {
53 return run<T>(position, start, end);
57 struct backInOutEasing {
59 static T run(
float position, T start, T end) {
64 constexpr float d = 1;
66 if ((t /= d / 2) < 1)
return static_cast<T
>(c / 2 * (t * t * ((s + 1) * t - s)) + b);
67 const float postFix = t -= 2;
68 return static_cast<T
>(c / 2 * (postFix * t * ((s + 1) * t + s) + 2) + b);
72 T operator()(
const float position, T start, T end)
const {
73 return run<T>(position, start, end);