Skip to content

Commit

Permalink
Merge pull request #174 from agoat/master
Browse files Browse the repository at this point in the history
Fix false number recomposing and NaN number problem
  • Loading branch information
juliangarnier authored Aug 30, 2017
2 parents 555420d + 178c4b2 commit 1c889cb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions anime.js
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@
}

function recomposeValue(numbers, strings) {
return (strings.length === 0) ? numbers[0] : strings.reduce((a, b, i) => a + numbers[i - 1] + b);
return (strings.length === 0) ? numbers[0] : strings.reduce((a, b, i) => a + numbers[i - 1] + (b ? b : ' '));
}

// Animatables
Expand Down Expand Up @@ -703,7 +703,7 @@
const elapsed = minMaxValue(insTime - tween.start - tween.delay, 0, tween.duration) / tween.duration;
const eased = tween.easing(elapsed, tween.elasticity);
const progress = recomposeValue(tween.to.numbers.map((number, p) => {
const start = isPath ? 0 : tween.from.numbers[p];
const start = isPath || !tween.from.numbers[p] ? 0 : tween.from.numbers[p];
let value = start + eased * (number - start);
if (isPath) value = getPathProgress(tween.value, value);
if (round) value = Math.round(value * round) / round;
Expand Down

0 comments on commit 1c889cb

Please sign in to comment.