51 return 1.0 - std::cos(t * math::half_pi<T>());
102 template <
typename T>
108 template <
typename T>
114 template <
typename T>
120 template <
typename T>
123 return t * t * t * t;
126 template <
typename T>
132 template <
typename T>
138 template <
typename T>
144 template <
typename T>
147 return t * t * t * t * t;
150 template <
typename T>
156 template <
typename T>
162 template <
typename T>
168 template <
typename T>
171 return std::pow(2.0, 10 * (t - 1.0));
174 template <
typename T>
180 template <
typename T>
186 template <
typename T>
192 template <
typename T>
195 return 1.0 - std::sqrt(1.0 - t * t);
198 template <
typename T>
204 template <
typename T>
210 template <
typename T>
216 template <
typename T,
typename Arg = T>
219 return t * t * ((s + 1.0) * t - s);
222 template <
typename T,
typename Arg = T>
228 template <
typename T,
typename Arg = T>
234 template <
typename T,
typename Arg = T>
240 template <
typename T,
typename Arg = T>
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));
258 template <
typename T,
typename Arg = T>
264 template <
typename T,
typename Arg = T>
270 template <
typename T,
typename Arg = T>
276 template <
typename T>
279 if (t < (1.0 / 2.75))
281 return (7.5625 * t * t);
283 else if (t < (2.0 / 2.75))
286 return (7.5625 * t * t + 0.75);
288 else if (t < (2.5 / 2.75))
291 return (7.5625 * t * t + 0.9375);
296 return (7.5625 * t * t + 0.984375);
300 template <
typename T>
306 template <
typename T>
312 template <
typename T>
318 template <
typename T>
324 template <
typename T>
358 return static_cast<easing_class>(
static_cast<uint32_t
>(lhs) |
static_cast<uint32_t
>(rhs));
363 return static_cast<easing_class>(
static_cast<uint32_t
>(lhs) &
static_cast<uint32_t
>(rhs));
368 return static_cast<easing_class>(~static_cast<uint32_t>(lhs));
471 return static_cast<easing>(
static_cast<uint32_t
>(lhs) |
static_cast<uint32_t
>(rhs));
476 return static_cast<easing>(
static_cast<uint32_t
>(lhs) &
static_cast<uint32_t
>(rhs));
531 return STANDARD_EASINGS;
543 template <
typename T>
546 auto standard_result = [e, t]()
641 throw std::logic_error(
"neogfx::easing: unknown easing type");
644 auto result = standard_result();
646 result = 1.0 - result;
650 template <
typename T>
656 template <
typename T>
659 return (t < 0.5 ?
ease(e1, t / 0.5) : 1.0 +
ease(e2, (t - 0.5) / 0.5)) / 2.0;
662 template <
typename T>
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;
668 template <
typename T>
671 return ease(e, t / d) * c + b;
674 template <
typename T>
677 auto const wTotal = w1 + w2;
678 return t < w1 / wTotal ?
ease(e1, t / (w1 / wTotal)) :
ease(e2, (t - (w1 / wTotal)) / (w2 / wTotal));
681 template <
typename T>
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));
696 static const std::unordered_map<easing, std::string> STRING_MAP =
746 auto s = STRING_MAP.find(e);
747 if (s != STRING_MAP.end())
749 throw std::logic_error(
"neogfx::to_string: unknown easing type");
constexpr style_aspect operator&(style_aspect aLhs, style_aspect aRhs)
T partitioned_ease(easing e1, easing e2, T t, double w1=1.0, double w2=1.0)
audio_channel operator~(audio_channel lhs)
basic_length< T > in(T aValue)
T ease_out_elastic(T t, Arg a=0.5, Arg p=0.25)
std::array< easing, 43 > standard_easings_t
std::string to_string(note const &aNote)
T ease_out_in_elastic(T t, Arg a=0.5, Arg p=0.25)
T ease_out_in_back(T t, Arg s=1.70158)
T ease_in_elastic(T t, Arg a=0.5, Arg p=0.25)
T ease_out_in_bounce(T t)
const standard_easings_t & standard_easings()
T ease_in_back(T t, Arg s=1.70158)
T ease_in_out_elastic(T t, Arg a=0.5, Arg p=0.25)
T ease_in_out_bounce(T t)
constexpr style_aspect operator|(style_aspect aLhs, style_aspect aRhs)
uint32_t standard_easing_index(easing aEasing)
T ease_out_back(T t, T s=1.70158)
T ease_in_out_back(T t, Arg s=1.70158)
std::optional< easing > optional_easing
iterator_traits< it_type >::difference_type distance(const it_type first, const it_type last)