// *********************************************************************************** // CONSTRUCTOR // *********************************************************************************** /// <summary> /// Creates a new instance. /// </summary> /// <param name="p_ease"> /// The ease function. /// </param> /// <param name="p_inverseEase"> /// Inverse ease function. /// </param> EaseInfo(TweenDelegate.EaseFunc p_ease, TweenDelegate.EaseFunc p_inverseEase) { ease = p_ease; inverseEase = p_inverseEase; }
/// <summary> /// Sets the ease type (called during Init, but can also be called by Tweener to change easeType while playing). /// </summary> internal void SetEase(EaseType p_easeType) { easeType = p_easeType; if (easeType == EaseType.AnimationCurve) { if (tweenObj._easeAnimationCurve != null) { easeCurve = new EaseCurve(tweenObj._easeAnimationCurve); ease = easeCurve.Evaluate; } else { // Missing animation curve: set to normal ease easeType = EaseType.EaseOutQuad; easeInfo = EaseInfo.GetEaseInfo(easeType); ease = easeInfo.ease; } } else { easeInfo = EaseInfo.GetEaseInfo(easeType); ease = easeInfo.ease; } if (_easeReversed && easeInfo.inverseEase != null) { ease = easeInfo.inverseEase; } }
/// <summary> /// Creates a new instance of this plugin with the given options. /// </summary> /// <param name="p_endVal"> /// The <see cref="object"/> value to tween to. /// </param> /// <param name="p_easeAnimCurve"> /// The <see cref="AnimationCurve"/> to use for easing. /// </param> /// <param name="p_isRelative"> /// If <c>true</c>, the given end value is considered relative instead than absolute. /// </param> protected ABSTweenPlugin(object p_endVal, AnimationCurve p_easeAnimCurve, bool p_isRelative) { isRelative = p_isRelative; _endVal = p_endVal; easeType = EaseType.AnimationCurve; easeCurve = new EaseCurve(p_easeAnimCurve); easeInfo = null; ease = easeCurve.Evaluate; }
/// <summary> /// Reverses the ease of this plugin. /// </summary> internal void ReverseEase() { _easeReversed = !_easeReversed; if (easeType == EaseType.AnimationCurve) return; // No reverse ease allowed if (easeInfo.inverseEase == null) return; // No inverse for this ease. ease = (_easeReversed ? easeInfo.inverseEase : easeInfo.ease); }
/// <summary> /// Creates a new instance of this plugin with the given options. /// </summary> /// <param name="p_endVal"> /// The <see cref="object"/> value to tween to. /// </param> /// <param name="p_easeType"> /// The <see cref="EaseType"/> to use. /// </param> /// <param name="p_isRelative"> /// If <c>true</c>, the given end value is considered relative instead than absolute. /// </param> protected ABSTweenPlugin(object p_endVal, EaseType p_easeType, bool p_isRelative) { isRelative = p_isRelative; _endVal = p_endVal; easeType = p_easeType; easeInfo = EaseInfo.GetEaseInfo(p_easeType); ease = easeInfo.ease; }