/// <summary> /// This will tween the "point" value on a Rotation Tween. Use this if you have a Rotation tween on a GameObject that is moving. /// </summary> public Tween TweenRotationPoint(TweenStyle tweenStyle, Vector3 fromPoint, Vector3 toPoint, float duration, LoopType loopType = LoopType.None) { // If the TweenType for the current Tween is not a Rotation then do nothing if (tweenType != TweenType.Rotation) { Debug.LogWarning("Cannot set a TweenType.RotationPoint on a Tween that is not a TweenType.Rotation."); return(null); } Tween tween = GetTween(this.gameObject, TweenType.RotationPoint); if (tween == null) { tween = this.gameObject.AddComponent <Tween>(); } tween.tweenType = TweenType.RotationPoint; tween.tweenStyle = tweenStyle; tween.fromPoint = fromPoint; tween.toPoint = toPoint; tween.duration = duration; tween.loopType = loopType; return(tween); }
public void SetTweenInfo(TweenInfo info) { m_Duration = info.duration; m_Style = info.style; m_UpdateType = info.updateType; m_UnscaledDeltaTime = info.unscaledDeltaTime; }
private static Tween CreateColourTween(GameObject obj, TweenType tweenType, TweenStyle tweenStyle, Color fromValue, Color toValue, float duration, LoopType loopType) { Tween tween = GetTween(obj, tweenType); if (tween == null) { tween = obj.AddComponent <Tween>(); } tween.tweenType = tweenType; tween.tweenStyle = tweenStyle; tween.fromColour = fromValue; tween.toColour = toValue; tween.duration = duration; tween.loopType = loopType; return(tween); }
public void SetUpTween(TweenStyle scaleTween) { if (_element is null) { return; } if (scaleTween != TweenStyle.NoTween) { DoScaleTween = true; } else { DoScaleTween = false; var localScale = _element.localScale; _startScale = localScale; _fullSize = localScale; _endScale = localScale; } if (scaleTween == TweenStyle.InAndOut) { _startScale = Vector3.zero; _fullSize = _element.localScale; _endScale = Vector3.zero; MidTween = true; } else { if (scaleTween == TweenStyle.In) { _startScale = Vector3.zero; _fullSize = Vector3.zero; _endScale = _element.localScale; } else { _startScale = _element.localScale; _fullSize = Vector3.zero; _endScale = Vector3.zero; } MidTween = false; } }
private static Tween CreateTween(GameObject obj, TweenType tweenType, TweenStyle tweenStyle, float fromValue, float toValue, float duration, bool transformLocal, LoopType loopType) { Tween tween = GetTween(obj, tweenType); if (tween == null) { tween = obj.AddComponent <Tween>(); } tween.tweenType = tweenType; tween.tweenStyle = tweenStyle; tween.fromValue = fromValue; tween.toValue = toValue; tween.duration = duration; tween.useLocal = transformLocal; tween.loopType = loopType; return(tween); }
private static Tween CreateRotationTween(GameObject obj, TweenType tweenType, TweenStyle tweenStyle, Transform point, Vector3 axis, float angle, float duration, LoopType loopType) { Tween tween = GetTween(obj, tweenType); if (tween == null) { tween = obj.AddComponent <Tween>(); } tween.angleSoFar = 0; tween.tweenType = tweenType; tween.tweenStyle = tweenStyle; tween.pointT = point; tween.axis = axis; tween.fromValue = 0; tween.toValue = angle; tween.duration = duration; tween.loopType = loopType; return(tween); }
public void SetUpTween(TweenStyle rotationTween) { if (_element is null) { return; } if (rotationTween != TweenStyle.NoTween) { RotationTween = true; } else { RotationTween = false; _rotateFrom = Vector3.zero; _rotateMidPoint = Vector3.zero; _rotateToo = Vector3.zero; } if (rotationTween == TweenStyle.InAndOut) { _rotateMidPoint = _element.localRotation.eulerAngles; MidRotation = true; } else { if (rotationTween == TweenStyle.In) { _rotateToo = _element.localRotation.eulerAngles; } else { _rotateFrom = _element.localRotation.eulerAngles; } MidRotation = false; } }
/// <summary> /// Tweens the color of the Material /// </summary> public static Tween Colour(Renderer renderer, TweenStyle tweenStyle, Color fromValue, Color toValue, float duration, LoopType loopType = LoopType.None) { return(CreateColourTween(renderer.gameObject, TweenType.ColourMaterial, tweenStyle, fromValue, toValue, duration, loopType)); }
/// <summary> /// Tweens the color of the UI Text /// </summary> public static Tween Colour(UnityEngine.UI.Text uiText, TweenStyle tweenStyle, Color fromValue, Color toValue, float duration, LoopType loopType = LoopType.None) { return(CreateColourTween(uiText.gameObject, TweenType.ColourText, tweenStyle, fromValue, toValue, duration, loopType)); }
/// <summary> /// Rotates the GameObject around a point on the axis by the given angle /// </summary> public static Tween RotateAround(Transform transform, TweenStyle tweenStyle, Transform point, Vector3 axis, float angle, float duration, LoopType loopType = LoopType.None) { return(CreateRotationTween(transform.gameObject, TweenType.Rotation, tweenStyle, point, axis, angle, duration, loopType)); }
/// <summary> /// Tweens the Z scale of the GameObject /// </summary> public static Tween ScaleZ(Transform transform, TweenStyle tweenStyle, float fromValue, float toValue, float duration, LoopType loopType = LoopType.None) { return(CreateTween(transform.gameObject, TweenType.ScaleZ, tweenStyle, fromValue, toValue, duration, true, loopType)); }
/// <summary> /// Tweens the alpha on a canvas group /// </summary> public static Tween CanvasGroupAlpha(CanvasGroup canvasGroup, TweenStyle tweenStyle, float fromValue, float toValue, float duration) { return(CreateTween(canvasGroup.gameObject, TweenType.CanvaGroup, tweenStyle, fromValue, toValue, duration, false, LoopType.None)); }
public void SetUpTween(TweenStyle tween) { PositionTween = tween != TweenStyle.NoTween; MiddleTween = tween == TweenStyle.InAndOut; ClearPositionTween(); }
public virtual void SetAlpha(float startalpha, float alpha, float animTime, TweenStyle style) { }
public void ClearSettings(TweenStyle clear) { _positionSettings.SetUpTween(clear); _rotationSettings.SetUpTween(clear); _scaleSettings.SetUpTween(clear); }
/// <summary> /// Tweens the Z position of the GameObject /// </summary> public static Tween PositionZ(Transform transform, TweenStyle tweenStyle, float fromValue, float toValue, float duration, bool transformLocal = false, LoopType loopType = LoopType.None) { return(CreateTween(transform.gameObject, TweenType.PositionZ, tweenStyle, fromValue, toValue, duration, transformLocal, loopType)); }
/// <summary> /// Tweens the height of the RectTransform /// </summary> public static Tween RectTransformHeight(RectTransform transform, TweenStyle tweenStyle, float fromValue, float toValue, float duration) { return(CreateTween(transform.gameObject, TweenType.RectTransformHeight, tweenStyle, fromValue, toValue, duration, false, LoopType.None)); }