Skip to content

Instantly share code, notes, and snippets.

@rje
Last active August 29, 2015 14:15
Show Gist options
  • Save rje/edeaf51f9949a858ab90 to your computer and use it in GitHub Desktop.
Save rje/edeaf51f9949a858ab90 to your computer and use it in GitHub Desktop.
public AnimationCurve _transitionCurve;
public IEnumerator MyCustomTransition(Vector3 orig, Vector3 dest, float duration)
{
var time = 0.0f;
var difference = dest - orig;
while (time <= duration)
{
var percentage = Mathf.Clamp01(time / duration);
var curveValue = _transitionCurve.Evaluate(percentage);
var pos = orig + curveValue * difference;
transform.position = pos;
time += Time.deltaTime;
yield return null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment