} //END Rotate //---------------------------------------------// /// <summary> /// Rotates a Transform or RectTransform using Quaternions. Supply this function with the localEulerAngles for the 'endValue' and 'startValue' /// </summary> /// <typeparam name="T">Transform</typeparam> /// <param name="tweenThis">Accepts [Transform, RectTransform]</param> /// <param name="endValue">What should the localEulerAngles for the transform be by the end of this rotation?</param> /// <param name="length">How long tween should take</param> /// <param name="easeType">What easing you would like to use</param> /// <param name="startValue">[OPTIONAL] Value to start from. If not provided we will use the existing value from the 'tweenThis' object</param> /// <param name="delay">[OPTIONAL] How long we should wait before starting to tween</param> /// <param name="loop">[OPTIONAL] Keep the tween running via a loop indefinitely</param> /// <param name="onCompleteOrLoop">[OPTIONAL] A UnityEvent to call once the tween has finished or completed a single loop</param> /// <returns></returns> public static bxrTween Rotate<T>( this T tweenThis, Vector3 endValue, float length, EaseCurve.EaseType easeType, Vector3? startValue = null, float delay = 0f, bool loop = false, UnityEvent onCompleteOrLoop = null ) where T : Transform //---------------------------------------------// { return TweenManager.Rotate( tweenThis, endValue, length, EaseCurve.GetEaseCurve( easeType ), startValue, delay, loop, onCompleteOrLoop ); } //END Rotate
} //END Move //------------------------------------------------------------------// /// <summary> /// Move a Transform across local or global space /// </summary> /// <typeparam name="T">Transform</typeparam> /// <param name="tweenThis">Accepts [Transform, RectTransform]</param> /// <param name="endValue">The position you would like to move this Transform to</param> /// <param name="length">How long tween should take</param> /// <param name="easeType">What easing you would like to use</param> /// <param name="startValue">[OPTIONAL] Value to start from. If not provided we will use the existing value from the 'tweenThis' object</param> /// <param name="useLocalOrWorldSpace">[OPTIONAL] Would you like this transform to move in local or global space?</param> /// <param name="delay">[OPTIONAL] How long we should wait before starting to tween</param> /// <param name="loop">[OPTIONAL] Keep the tween running via a loop indefinitely</param> /// <param name="onCompleteOrLoop">[OPTIONAL] A UnityEvent to call once the tween has finished or completed a single loop</param> /// <returns></returns> public static bxrTween Move<T>( this T tweenThis, Vector3 endValue, float length, EaseCurve.EaseType easeType, Vector3? startValue = null, bxrTweenPosition.LocalOrWorldSpace useLocalOrWorldSpace = bxrTweenPosition.LocalOrWorldSpace.Local, float delay = 0f, bool loop = false, UnityEvent onCompleteOrLoop = null ) where T : Transform //------------------------------------------------------------------// { return TweenManager.Move( tweenThis, endValue, length, EaseCurve.GetEaseCurve( easeType ), startValue, useLocalOrWorldSpace, delay, loop, onCompleteOrLoop ); } //END Move
} //END TweenFloat //---------------------------------------------// /// <summary> /// Change any float value by passing in the UnityEngine Object and a fieldName /// </summary> /// <typeparam name="T">UnityEngine Object</typeparam> /// <param name="tweenThis">The UnityEngine Object that will have it's value tweened</param> /// <param name="fieldName">The variable ('field') we should tween</param> /// <param name="endValue">Float value to tween to</param> /// <param name="length">How long tween should take</param> /// <param name="easeType">The easing you would like this tween to use</param> /// <param name="startValue">[OPTIONAL] Value to start from. If not provided we will use the existing value from the 'tweenThis' object</param> /// <param name="delay">[OPTIONAL] How long we should wait before starting to tween</param> /// <param name="loop">[OPTIONAL] Keep the tween running via a loop indefinitely</param> /// <param name="onCompleteOrLoop">[OPTIONAL] A UnityEvent to call once the tween has finished or completed a single loop</param> /// <returns></returns> public static bxrTween TweenFloat<T>( this T tweenThis, string fieldName, float endValue, float length, EaseCurve.EaseType easeType, float? startValue = null, float delay = 0f, bool loop = false, UnityEvent onCompleteOrLoop = null ) where T : UnityEngine.Object //---------------------------------------------// { return TweenManager.TweenFloat( tweenThis, fieldName, endValue, length, EaseCurve.GetEaseCurve( easeType ), startValue, delay, loop, onCompleteOrLoop ); } //END TweenFloat
} //END AudioPitch //---------------------------------------------// /// <summary> /// Change the pitch value for an AudioSource /// </summary> /// <param name="tweenThis">Accepts [AudioSource]</param> /// <param name="endValue">What should the final pitch value be?</param> /// <param name="length">How long tween should take</param> /// <param name="easeType">The ease type you would like this tween to use</param> /// <param name="startValue">[OPTIONAL] Value to start from. If not provided we will use the existing value from the 'tweenThis' object</param> /// <param name="delay">[OPTIONAL] How long we should wait before starting to tween</param> /// <param name="loop">[OPTIONAL] Keep the tween running via a loop indefinitely</param> /// <param name="onCompleteOrLoop">[OPTIONAL] A UnityEvent to call once the tween has finished or completed a single loop</param> /// <returns></returns> public static bxrTween AudioPitch( this AudioSource tweenThis, float endValue, float length, EaseCurve.EaseType easeType, float? startValue = null, float delay = 0f, bool loop = false, UnityEvent onCompleteOrLoop = null ) //---------------------------------------------// { return TweenManager.TweenFloat( tweenThis, "pitch", endValue, length, EaseCurve.GetEaseCurve( easeType ), startValue, delay, loop, onCompleteOrLoop ); } //END AudioPitch
} //END Color //---------------------------------------------// /// <summary> /// Change the color for the passed in Renderer or Material /// </summary> /// <typeparam name="T">Renderer/Object</typeparam> /// <param name="tweenThis">Accepts [Renderer, Image, RawImage, SpriteRenderer, Text, Material, CanvasGroup]</param> /// <param name="endValue">Color to tween to</param> /// <param name="length">How long tween should take</param> /// <param name="easeType">What ease type you would like this tween to use</param> /// <param name="startValue">[OPTIONAL] Value to start from. If not provided we will use the existing value from the 'tweenThis' object</param> /// <param name="delay">[OPTIONAL] How long we should wait before starting to tween</param> /// <param name="loop">[OPTIONAL] Keep the tween running via a loop indefinitely</param> /// <param name="onCompleteOrLoop">[OPTIONAL] A UnityEvent to call once the tween has finished or completed a single loop</param> /// <returns></returns> public static bxrTween Color<T>( this T tweenThis, Color endValue, float length, EaseCurve.EaseType easeType, Color? startValue = null, float delay = 0f, bool loop = false, UnityEvent onCompleteOrLoop = null ) //---------------------------------------------// { return TweenManager.Color( tweenThis, endValue, length, EaseCurve.GetEaseCurve( easeType ), startValue, delay, loop, onCompleteOrLoop ); } //END Color
} //END ImageFill //---------------------------------------------// /// <summary> /// Change the fill value for an Image object /// </summary> /// <param name="tweenThis">Accepts [Image]</param> /// <param name="endValue">What should the final fill value be?</param> /// <param name="length">How long tween should take</param> /// <param name="easeType">What ease you would like this tween to use</param> /// <param name="startValue">[OPTIONAL] Value to start from. If not provided we will use the existing value from the 'tweenThis' object</param> /// <param name="delay">[OPTIONAL] How long we should wait before starting to tween</param> /// <param name="loop">[OPTIONAL] Keep the tween running via a loop indefinitely</param> /// <param name="onCompleteOrLoop">[OPTIONAL] A UnityEvent to call once the tween has finished or completed a single loop</param> /// <returns></returns> public static bxrTween ImageFill( this Image tweenThis, float endValue, float length, EaseCurve.EaseType easeType, float? startValue = null, float delay = 0f, bool loop = false, UnityEvent onCompleteOrLoop = null ) //---------------------------------------------// { return TweenManager.TweenFloat( tweenThis, "fillAmount", endValue, length, EaseCurve.GetEaseCurve( easeType ), startValue, delay, loop, onCompleteOrLoop ); } //END ImageFill