public static Coroutine AnchoredPositionEase(this RectTransform rect, Vector3 target, float length, EasingTypes easingChoice, bool unscaled = false, TweenRepeat repeat = TweenRepeat.Once, Action onComplete = null) { Vector3 start = rect.anchoredPosition3D; return(TweenManager.instance.PlayTween(new Tween((Vector3 newPosition) => { rect.anchoredPosition3D = newPosition; }, start, target, length, easingChoice, unscaled, repeat, onComplete))); }
public static Coroutine JumpHorizontal(this ScrollRect scrollRect, float target, float length, EasingTypes easingChoice, bool unscaled = false, TweenRepeat repeat = TweenRepeat.Once, Action onComplete = null) { float start = scrollRect.horizontalNormalizedPosition; return(TweenManager.instance.PlayTween(new Tween((float newPosition) => { scrollRect.horizontalNormalizedPosition = newPosition; }, start, target, length, easingChoice, unscaled, repeat, onComplete))); }
public static Coroutine EaseFill(this Image image, float target, float length, EasingTypes easingChoice, bool unscaled = false, TweenRepeat repeat = TweenRepeat.Once, Action onComplete = null) { float start = image.fillAmount; return(TweenManager.instance.PlayTween(new Tween((float newFill) => { image.fillAmount = newFill; }, start, target, length, easingChoice, unscaled, repeat, onComplete))); }
public static Coroutine FadeTo(this CanvasGroup cgroup, float target, float length, EasingTypes easingChoice, bool unscaled = false, TweenRepeat repeat = TweenRepeat.Once, Action onComplete = null) { float start = cgroup.alpha; return(TweenManager.instance.PlayTween(new Tween((float newAlpha) => { cgroup.alpha = newAlpha; }, start, target, length, easingChoice, unscaled, repeat, onComplete))); }
public static Coroutine EaseLayoutMinValues(this LayoutElement layout, Vector2 target, float length, EasingTypes easingChoice, bool unscaled = false, TweenRepeat repeat = TweenRepeat.Once, Action onComplete = null) { Vector2 start = new Vector2(layout.minWidth, layout.minHeight); return(TweenManager.instance.PlayTween(new Tween((Vector2 newDimensions) => { layout.minWidth = newDimensions.x; layout.minHeight = newDimensions.y; }, start, target, length, easingChoice, unscaled, repeat, onComplete))); }
/// <summary> /// Use this for animating colours /// </summary> /// <param name="valueSetter">Value setter.</param> /// <param name="from">From.</param> /// <param name="to">To.</param> /// <param name="length">Length.</param> /// <param name="easeType">Ease type.</param> /// <param name="unscaled">If set to <c>true</c> unscaled.</param> /// <param name="repeat">Repeat.</param> /// <param name="OnComplete">On complete.</param> public Tween(Action <Color> valueSetter, Color from, Color to, float length, EasingTypes easeType = EasingTypes.Linear, bool unscaled = false, TweenRepeat repeat = TweenRepeat.Once, Action OnComplete = doNothing) { this.valSetC = valueSetter; this.fromC = from; this.toC = to; this.easeFunc = Easing.Function(easeType); this.resttime = this.originaltime = length; this.OnComplete = OnComplete; this.type = TweenType.c; this.repeat = repeat; this.time = timeFunc(unscaled); }
/// <summary> /// Use this for animating a Vector3 /// </summary> /// <param name="valueSetter">Value setter.</param> /// <param name="from">From.</param> /// <param name="to">To.</param> /// <param name="length">Length.</param> /// <param name="easeType">Ease type.</param> /// <param name="unscaled">If set to <c>true</c> unscaled.</param> /// <param name="repeat">Repeat.</param> /// <param name="OnComplete">On complete.</param> public Tween(Action <Vector3> valueSetter, Vector3 from, Vector3 to, float length, EasingTypes easeType = EasingTypes.Linear, bool unscaled = false, TweenRepeat repeat = TweenRepeat.Once, Action OnComplete = doNothing) { this.valSetv3 = valueSetter; this.fromV3 = from; this.toV3 = to; this.easeFunc = Easing.Function(easeType); this.resttime = this.originaltime = length; this.OnComplete = OnComplete; this.type = TweenType.v3; this.repeat = repeat; this.time = timeFunc(unscaled); }
/// <summary> /// Use this for animating a Vector2 /// </summary> /// <param name="valueSetter">Value setter.</param> /// <param name="from">From.</param> /// <param name="to">To.</param> /// <param name="length">Length.</param> /// <param name="easeType">Ease type.</param> /// <param name="unscaled">If set to <c>true</c> unscaled.</param> /// <param name="repeat">Repeat.</param> /// <param name="OnComplete">On complete.</param> public Tween(Action <Vector2> valueSetter, Vector2 from, Vector2 to, float length, EasingTypes easeType = EasingTypes.Linear, bool unscaled = false, TweenRepeat repeat = TweenRepeat.Once, Action OnComplete = doNothing) { this.valueSetterVector2 = valueSetter; this.fromVector2 = from; this.toVector2 = to; this.easeFunctionDelegate = EasingFunctions.Function(easeType); this.restTime = this.originalTime = length; this.OnComplete = OnComplete; this.type = TweenType.v2; this.repeat = repeat; this.deltaTimeDelegate = TimeFunction(unscaled); }
/// <summary> /// Use this for animating a Vector2 /// </summary> /// <param name="valueSetter">Value setter.</param> /// <param name="from">From.</param> /// <param name="to">To.</param> /// <param name="length">Length.</param> /// <param name="easeType">Ease type.</param> /// <param name="unscaled">If set to <c>true</c> unscaled.</param> /// <param name="repeat">Repeat.</param> /// <param name="OnComplete">On complete.</param> public Tween(Action <Vector2> valueSetter, Vector2 from, Vector2 to, float length, EasingTypes easeType = EasingTypes.Linear, bool unscaled = false, TweenRepeat repeat = TweenRepeat.Once, System.Action OnComplete = doNothing) { valSetv2 = valueSetter; fromV2 = from; toV2 = to; easeFunc = Easing.Function(easeType); resttime = originaltime = length; this.OnComplete = OnComplete; type = TweenType.v2; this.repeat = repeat; time = timeFunc(unscaled); }
/// <summary> /// Use this for animating float values. The first parameter has to a setter for the float /// </summary> /// <param name="valueSetter">Value setter.</param> /// <param name="from">From.</param> /// <param name="to">To.</param> /// <param name="length">Length.</param> /// <param name="easeType">Ease type.</param> /// <param name="unscaled">If set to <c>true</c> unscaled.</param> /// <param name="repeat">Repeat.</param> /// <param name="OnComplete">On complete.</param> public Tween(Action <float> valueSetter, float from, float to, float length, EasingTypes easeType = EasingTypes.Linear, bool unscaled = false, TweenRepeat repeat = TweenRepeat.Once, System.Action OnComplete = doNothing) { valSet = valueSetter; this.from = from; this.to = to; easeFunc = Easing.Function(easeType); resttime = originaltime = length; this.OnComplete = OnComplete; type = TweenType.f; this.repeat = repeat; time = timeFunc(unscaled); }