2#include <ossia/detail/config.hpp> 
   39  template <
typename T, 
typename U, 
typename V>
 
   40  constexpr T operator()(T a, U b, V t) 
const noexcept 
   42#if defined(FP_FAST_FMA) 
   43    return ossia::fma(t, b, ossia::fma(-t, a, a));
 
   45    return (
static_cast<T
>(1) - t) * a + t * b;
 
   52  static consteval std::string_view name() noexcept { 
return "linear"; }
 
   54  constexpr T operator()(T t) 
const noexcept 
   63  static consteval std::string_view name() noexcept { 
return "power"; }
 
   65  static constexpr V linear_gamma = 1.0;
 
   66  V gamma = linear_gamma;
 
   69  constexpr T operator()(T t) 
const noexcept 
   71    return std::pow(t, gamma);
 
   77  static consteval std::string_view name() noexcept { 
return "quadraticIn"; }
 
   79  constexpr T operator()(T t) 
const noexcept 
   87  static consteval std::string_view name() noexcept { 
return "quadraticOut"; }
 
   89  constexpr T operator()(T t) 
const noexcept 
   91    return -(t * (t - 2.));
 
   97  static consteval std::string_view name() noexcept { 
return "quadraticInOut"; }
 
   99  constexpr T operator()(T t) 
const noexcept 
  101    return (t < 0.5) ? 2. * t * t : (-2. * t * t) + (4. * t) - 1.;
 
  107  static consteval std::string_view name() noexcept { 
return "cubicIn"; }
 
  108  template <
typename T>
 
  109  constexpr T operator()(T t) 
const noexcept 
  117  static consteval std::string_view name() noexcept { 
return "cubicOut"; }
 
  118  template <
typename T>
 
  119  constexpr T operator()(T t) 
const noexcept 
  121    return ipow(t - 1., 3) + 1.;
 
  127  static consteval std::string_view name() noexcept { 
return "cubicInOut"; }
 
  128  template <
typename T>
 
  129  constexpr T operator()(T t) 
const noexcept 
  131    return (t < T(0.5)) ? 4. * ipow(t, 3) : 0.5 * ipow((2. * t) - 2, 3) + 1.;
 
  137  static consteval std::string_view name() noexcept { 
return "quarticIn"; }
 
  138  template <
typename T>
 
  139  constexpr T operator()(T t) 
const noexcept 
  147  static consteval std::string_view name() noexcept { 
return "quarticOut"; }
 
  148  template <
typename T>
 
  149  constexpr T operator()(T t) 
const noexcept 
  151    return ipow(t - 1., 3) * (1. - t) + 1.;
 
  157  static consteval std::string_view name() noexcept { 
return "quarticInOut"; }
 
  158  template <
typename T>
 
  159  constexpr T operator()(T t) 
const noexcept 
  161    return (t < 0.5) ? 8. * ipow(t, 4) : -8. * ipow(t - 1., 4) + 1.;
 
  167  static consteval std::string_view name() noexcept { 
return "quinticIn"; }
 
  168  template <
typename T>
 
  169  constexpr T operator()(T t) 
const noexcept 
  177  static consteval std::string_view name() noexcept { 
return "quinticOut"; }
 
  178  template <
typename T>
 
  179  constexpr T operator()(T t) 
const noexcept 
  181    return ipow(t - 1., 5) + 1.;
 
  187  static consteval std::string_view name() noexcept { 
return "quinticInOut"; }
 
  188  template <
typename T>
 
  189  constexpr T operator()(T t) 
const noexcept 
  191    return (t < 0.5) ? 16. * ipow(t, 5) : 0.5 * ipow((2. * t) - 2., 5) + 1.;
 
  197  static consteval std::string_view name() noexcept { 
return "sineIn"; }
 
  198  template <
typename T>
 
  199  constexpr T operator()(T t) 
const noexcept 
  201    return std::sin((t - 1.) * half_pi) + 1.;
 
  207  static consteval std::string_view name() noexcept { 
return "sineOut"; }
 
  208  template <
typename T>
 
  209  constexpr T operator()(T t) 
const noexcept 
  211    return std::sin(t * half_pi);
 
  217  static consteval std::string_view name() noexcept { 
return "sineInOut"; }
 
  218  template <
typename T>
 
  219  constexpr T operator()(T t) 
const noexcept 
  221    return 0.5 * (1. - std::cos(t * pi));
 
  227  static consteval std::string_view name() noexcept { 
return "circularIn"; }
 
  228  template <
typename T>
 
  229  constexpr T operator()(T t) 
const noexcept 
  231    return 1. - std::sqrt(1. - (t * t));
 
  237  static consteval std::string_view name() noexcept { 
return "circularOut"; }
 
  238  template <
typename T>
 
  239  constexpr T operator()(T t) 
const noexcept 
  241    return std::sqrt((2. - t) * t);
 
  247  static consteval std::string_view name() noexcept { 
return "circularInOut"; }
 
  248  template <
typename T>
 
  249  constexpr T operator()(T t) 
const noexcept 
  251    return (t < 0.5) ? 0.5 * (1 - std::sqrt(1 - 4. * (t * t)))
 
  252                     : 0.5 * (std::sqrt(-((2. * t) - 3.) * ((2. * t) - 1.)) + 1.);
 
  258  static consteval std::string_view name() noexcept { 
return "exponentialIn"; }
 
  259  template <
typename T>
 
  260  constexpr T operator()(T t)
 const 
  262    return (t <= 0) ? t : ossia::exp2(10. * (t - 1.));
 
  268  static consteval std::string_view name() noexcept { 
return "exponentialOut"; }
 
  269  template <
typename T>
 
  270  constexpr T operator()(T t) 
const noexcept 
  272    return (t >= 1.) ? t : 1. - ossia::exp2(-10. * t);
 
  276struct exponentialInOut
 
  278  static consteval std::string_view name() noexcept { 
return "exponentialInOut"; }
 
  279  template <
typename T>
 
  280  constexpr T operator()(T t) 
const noexcept 
  282    return (t <= 0. || t >= 1.) ? t
 
  283           : (t < 0.5)          ? 0.5 * ossia::exp2((20. * t) - 10.)
 
  284                                : -0.5 * 
ossia::exp2((-20. * t) + 10.) + 1.;
 
  290  static consteval std::string_view name() noexcept { 
return "elasticIn"; }
 
  291  template <
typename T>
 
  292  constexpr T operator()(T t) 
const noexcept 
  294    return std::sin(13. * half_pi * t) * ossia::exp2(10. * (t - 1.));
 
  300  static consteval std::string_view name() noexcept { 
return "elasticOut"; }
 
  301  template <
typename T>
 
  302  constexpr T operator()(T t) 
const noexcept 
  304    return sin(-13. * half_pi * (t + 1.)) * ossia::exp2(-10. * t) + 1.;
 
  310  static consteval std::string_view name() noexcept { 
return "elasticInOut"; }
 
  311  template <
typename T>
 
  312  constexpr T operator()(T t) 
const noexcept 
  314    return (t < 0.5) ? 0.5 * std::sin(13. * half_pi * (2. * t))
 
  315                           * ossia::exp2(10. * ((2. * t) - 1.))
 
  317                           * (std::sin(-13. * half_pi * ((2. * t - 1) + 1))
 
  318                                  * 
ossia::exp2(-10. * (2. * t - 1.))
 
  325  static consteval std::string_view name() noexcept { 
return "backIn"; }
 
  326  template <
typename T>
 
  327  constexpr T operator()(T t) 
const noexcept 
  329    return ipow(t, 3) - t * std::sin(t * pi);
 
  335  static consteval std::string_view name() noexcept { 
return "backOut"; }
 
  336  template <
typename T>
 
  337  constexpr T operator()(T t) 
const noexcept 
  339    return 1. - (ipow(1. - t, 3) - (1. - t) * std::sin((1. - t) * pi));
 
  345  static consteval std::string_view name() noexcept { 
return "backInOut"; }
 
  346  template <
typename T>
 
  347  constexpr T operator()(T t) 
const noexcept 
  349    return (t < 0.5) ? 0.5 * (ipow(2. * t, 3) - (2. * t) * std::sin((2. * t) * pi))
 
  352                                  - (ipow(1. - (2. * t - 1.), 3)
 
  353                                     - (1. - (2. * t - 1.))
 
  354                                           * std::sin((1. - (2. * t - 1.)) * pi)))
 
  361  static consteval std::string_view name() noexcept { 
return "bounceOut"; }
 
  362  template <
typename T>
 
  363  constexpr T operator()(T t) 
const noexcept 
  365    return t < 4. / 11.     ? (121. * t * t) / 16.
 
  366           : (t < 8. / 11.) ? (363. / 40. * t * t) - (99 / 10. * t) + 17 / 5.
 
  368               ? (4356. / 361. * t * t) - (35442. / 1805. * t) + 16061. / 1805.
 
  369               : (54. / 5. * t * t) - (513. / 25. * t) + 268. / 25.;
 
  375  static consteval std::string_view name() noexcept { 
return "bounceIn"; }
 
  376  template <
typename T>
 
  377  constexpr T operator()(T t) 
const noexcept 
  379    return 1. - bounceOut{}(1. - t);
 
  385  static consteval std::string_view name() noexcept { 
return "bounceInOut"; }
 
  386  template <
typename T>
 
  387  constexpr T operator()(T t) 
const noexcept 
  389    return t < 0.5 ? 0.5 * bounceIn{}(t * 2.) : 0.5 * bounceOut{}(t * 2. - 1.) + 0.5;
 
  395  static consteval std::string_view name() noexcept { 
return "perlinInOut"; }
 
  396  template <
typename T>
 
  397  constexpr T operator()(T t) 
const noexcept 
  399    return 6. * ipow(t, 5) - 15. * ipow(t, 4) + 10. * ipow(t, 3);
 
  404template <
typename Y, 
typename Easing>
 
  405struct curve_segment_ease
 
  407  constexpr Y operator()(
double ratio, Y start, Y end) 
const noexcept 
  409    return easing::ease{}(start, end, Easing{}(ratio));