/// <summary> /// 动画移动到某位置 /// </summary> /// <returns></returns> public static TweenScript TnLocalMove(this Transform trans, Vector3 to, float time = 0.5f, float delayTime = 0) { TweenScript tweenTmp = StackObjectPool <TweenScript> .Get(); tweenTmp.SetValue(trans.localPosition, to); tweenTmp.isLocal = true; tweenTmp.Init(trans.gameObject, AnimType.Position, time, delayTime); TweenUtil.GetInstance().AddTween(tweenTmp); return(tweenTmp); }
public static TweenScript TnAlphaTo(this Transform trans, float from, float to, float time = 0.5f, float delayTime = 0) { TweenScript tweenTmp = StackObjectPool <TweenScript> .Get(); tweenTmp.SetValue(from, to); tweenTmp.Init(trans.gameObject, AnimType.Alpha, time, delayTime); TweenUtil.GetInstance().AddTween(tweenTmp); return(tweenTmp); }
/// <summary> /// UGUI RectTransfrom 放大缩小 /// width/height /// </summary> public static TweenScript TnUiSize(this RectTransform rectTrans, Vector2 to, float time = 0.5f, float delayTime = 0) { Vector2 fromTmp = rectTrans.sizeDelta; TweenScript tweenTmp = StackObjectPool <TweenScript> .Get(); tweenTmp.SetValue(fromTmp, to); tweenTmp.Init(rectTrans.gameObject, AnimType.UiSize, time, delayTime); TweenUtil.GetInstance().AddTween(tweenTmp); return(tweenTmp); }
/// <summary> /// UGUI Move RectTransform .anchoredPosition3D /// </summary> public static TweenScript TnAnchoredPosition(this RectTransform rectTrans, Vector3 to, float time = 0.5f, float delayTime = 0) { TweenScript tweenTmp = StackObjectPool <TweenScript> .Get(); tweenTmp.SetValue(rectTrans.anchoredPosition3D, to); tweenTmp.Init(rectTrans.gameObject, AnimType.UiAnchoredPosition, time, delayTime); TweenUtil.GetInstance().AddTween(tweenTmp); return(tweenTmp); }
public static TweenScript TnRotate(this Transform trans, Vector3 to, float time = 0.5f, float delayTime = 0, bool isLocal = true) { TweenScript tweenTmp = StackObjectPool <TweenScript> .Get(); tweenTmp.SetValue(isLocal ? trans.localEulerAngles : trans.eulerAngles, to); tweenTmp.isLocal = isLocal; tweenTmp.Init(trans.gameObject, AnimType.Rotate, time, delayTime); TweenUtil.GetInstance().AddTween(tweenTmp); return(tweenTmp); }
public static TweenScript CustomTweenFloat(UnityAction <float> method, float from, float to, float time = 0.5f, float delayTime = 0, LoopType repeatType = LoopType.Once, int repeatCount = -1) { TweenScript tweenTmp = StackObjectPool <TweenScript> .Get(); tweenTmp.SetValue(from, to); tweenTmp.customMethodFloat = new AnimCustomMethodFloat(); tweenTmp.customMethodFloat.AddListener(method); tweenTmp.SetLoopType(repeatType, repeatCount); tweenTmp.Init(null, AnimType.CustomFloat, time, delayTime); GetInstance().animList.Add(tweenTmp); return(tweenTmp); }
public static TweenScript CustomTweenVector3(UnityAction <Vector3> method, Vector3 from, Vector3 to, float time = 0.5f, float delayTime = 0, LoopType repeatType = LoopType.Once, int repeatCount = -1) { TweenScript tweenTmp = StackObjectPool <TweenScript> .Get(); tweenTmp.SetValue(from, to); tweenTmp.customMethodV3 = new AnimCustomMethodVector3(); if (method != null) { tweenTmp.customMethodV3.AddListener(method); } tweenTmp.SetLoopType(repeatType, repeatCount); tweenTmp.Init(null, AnimType.CustomVector3, time, delayTime); GetInstance().animList.Add(tweenTmp); return(tweenTmp); }