1 parent e8f7719 commit 88633cfCopy full SHA for 88633cf
1 file changed
src/include/sndx/math/easings.hpp
@@ -45,6 +45,16 @@ namespace sndx::math {
45
return T(1.0) - func(T(1.0) - a);
46
}
47
48
+ template <std::floating_point T, T(*Func)(T)> [[nodiscard]]
49
+ constexpr auto easeInOut(T a) noexcept {
50
+ if (a < T(0.5)) {
51
+ return Func(a * T(2.0)) / T(2.0);
52
+ }
53
+ else {
54
+ return (T(2.0) - Func((T(1.0) - a) * T(2.0))) / T(2.0);
55
56
57
+
58
template <std::floating_point T> [[nodiscard]]
59
constexpr auto easeLinear(T a) noexcept {
60
return a;
0 commit comments