public static Coroutine Tween(this Transform target, Transform from, Transform to, float duration, AnimationCurve curve = null, bool position = true, bool rotation = true, bool scale = true, bool ignoreTimeScale = false) { if (target == null) { throw new ArgumentNullException("target"); } if (to == null) { throw new ArgumentNullException("to"); } if (curve == null) { curve = defaultCurve; } Coroutine c; if (position && tPosDict.TryGetValue(target, out c)) { CoroutineHolder.FindAndStopCoroutine(c); } if (rotation && tRotDict.TryGetValue(target, out c)) { CoroutineHolder.FindAndStopCoroutine(c); } if (scale && tSclDict.TryGetValue(target, out c)) { CoroutineHolder.FindAndStopCoroutine(c); } c = CoroutineHolder.StartCoroutine(target, TweenRoute( target, from, to, duration, curve, position, rotation, scale, ignoreTimeScale )); if (position) { tPosDict[target] = c; } if (rotation) { tRotDict[target] = c; } if (scale) { tSclDict[target] = c; } return(c); }
public static Coroutine TweenRotation(this Transform target, Quaternion from, Quaternion to, float duration, AnimationCurve curve = null, bool ignoreTimeScale = false, bool local = false) { if (target == null) { throw new ArgumentNullException("target"); } if (curve == null) { curve = defaultCurve; } Coroutine c; if (tRotDict.TryGetValue(target, out c)) { CoroutineHolder.FindAndStopCoroutine(c); } c = CoroutineHolder.StartCoroutine(target, TweenRotationRoute( target, from, to, duration, curve, ignoreTimeScale, local )); tRotDict[target] = c; return(c); }