Skip to content

Commit

Permalink
Only interpolate numeric values.
Browse files Browse the repository at this point in the history
  • Loading branch information
EmersonYe committed Apr 12, 2020
1 parent 2a0610d commit 566f0fc
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/client/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ function interpolateObject(object1, object2, ratio) {
Object.keys(object1).forEach(key => {
if (key === 'direction') {
interpolated[key] = interpolateDirection(object1[key], object2[key], ratio);
} else if (isNaN(object1[key])) {
interpolated[key] = ratio > 0.5 ? object2[key] : object1[key];
} else {
interpolated[key] = object1[key] + (object2[key] - object1[key]) * ratio;
}
Expand Down

0 comments on commit 566f0fc

Please sign in to comment.