Last active
August 29, 2015 14:15
-
-
Save rje/edeaf51f9949a858ab90 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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