Progress: Interpolation & Smoothing

This commit is contained in:
Jeremiah Billmann
2013-06-26 21:29:45 -04:00
parent e321a24909
commit ad79f1a67a
2 changed files with 10 additions and 10 deletions
+3 -7
View File
@@ -22,17 +22,13 @@ $(function () {
}
return state;
},
onInterpolation: function (currentState, previousState, targetState, amount, delta) {
var interpolationState = {},
smoothState = {};
onInterpolation: function (currentState, previousState, targetState, amount) {
var interpolationState = {};
interpolationState.x = (previousState.x + amount * (targetState.x - previousState.x));
interpolationState.y = (previousState.y + amount * (targetState.y - previousState.y));
smoothState.x = (currentState.x + (20 * delta) * (interpolationState.x - currentState.x));
smoothState.y = (currentState.y + (20 * delta) * (interpolationState.y - currentState.y));
return smoothState;
return interpolationState;
}
});