private float tweenKeyFramesRotation(KeyFrame a, KeyFrame b, int time) { int timeBetweenFrames = b.k_KeyTime - a.k_KeyTime; int timeAfterA = time - a.k_KeyTime; float percentTween = (float)timeAfterA / (float)timeBetweenFrames; float aToB = b.k_KeyRotation - a.k_KeyRotation; return a.k_KeyRotation + aToB * percentTween; }
private Vector2 tweenKeyFramesPosition(KeyFrame a, KeyFrame b, int time) { int timeBetweenFrames = b.k_KeyTime - a.k_KeyTime; int timeAfterA = time - a.k_KeyTime; float percentTween = (float)timeAfterA / (float)timeBetweenFrames; Vector2 aToB = b.k_KeyPosition - a.k_KeyPosition; return a.k_KeyPosition + (aToB * percentTween); }