Skip to content

Commit

Permalink
properly calculates different-duration easing progress (fix #15)
Browse files Browse the repository at this point in the history
  • Loading branch information
mobius3 committed Feb 28, 2020
1 parent 1c2eb4e commit 1734f4f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/tween.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ namespace tweeny {
inline void tween<T, Ts...>::interpolate(float prog, unsigned point, typename traits::valuesType & values, detail::int2type<I>) const {
auto & p = points.at(point);
uint32_t pointDuration = p.duration() - (p.stacked - (prog * static_cast<float>(total)));
float pointTotal = static_cast<float>(pointDuration) / static_cast<float>(p.duration());
float pointTotal = static_cast<float>(pointDuration) / static_cast<float>(p.duration(I));
if (pointTotal > 1.0f) pointTotal = 1.0f;
auto easing = std::get<I>(p.easings);
std::get<I>(values) = easing(pointTotal, std::get<I>(p.values), std::get<I>(points.at(point+1).values));
Expand All @@ -130,7 +130,7 @@ namespace tweeny {
inline void tween<T, Ts...>::interpolate(float prog, unsigned point, typename traits::valuesType & values, detail::int2type<0>) const {
auto & p = points.at(point);
uint32_t pointDuration = p.duration() - (p.stacked - (prog * static_cast<float>(total)));
float pointTotal = static_cast<float>(pointDuration) / static_cast<float>(p.duration());
float pointTotal = static_cast<float>(pointDuration) / static_cast<float>(p.duration(0));
if (pointTotal > 1.0f) pointTotal = 1.0f;
auto easing = std::get<0>(p.easings);
std::get<0>(values) = easing(pointTotal, std::get<0>(p.values), std::get<0>(points.at(point+1).values));
Expand Down

0 comments on commit 1734f4f

Please sign in to comment.