//IEnumerator HandleTweenDelayed() //{ // float counter = 0; // while (counter < delay) // { // counter += Time.deltaTime; // yield return null; // } // HandleTween(); //} //IEnumerator Activate() //{ // float counter = 0; // while (counter < delay) // { // counter += Time.deltaTime; // yield return null; // } // objectToAnimate.SetActive(true); //} public void HandleTween() { if (objectToAnimate == null) { objectToAnimate = gameObject; } switch (animationType) { case UIAnimationType.Fade: Fade(); break; case UIAnimationType.Move: Move(); break; case UIAnimationType.MoveAbsolute: MoveAbsolute(); break; case UIAnimationType.Scale: Scale(); break; case UIAnimationType.ScaleX: ScaleX(); break; case UIAnimationType.ScaleY: ScaleY(); break; default: break; } _tweenObject.setDelay(delay); _tweenObject.setEase(easeType); if (loop) { _tweenObject.loopCount = int.MaxValue; } if (pingpong) { _tweenObject.setLoopPingPong(); } }
private void Animate() { switch (animationType) { case UIAnimationTypes.Fade: tweenObject = Fade(); break; case UIAnimationTypes.Move: tweenObject = Move(); break; case UIAnimationTypes.Scale: tweenObject = Scale(); break; } tweenObject.setDelay(delay); tweenObject.setEase(easeType); if (loop) { tweenObject.setLoopClamp(); } if (pingpong) { tweenObject.setLoopPingPong(); } }
private static LTDescr SetLastParameters(LTDescr tween, float delay, Action onCompleteAction, Ease ease) { tween.setDelay(delay); tween.setOnComplete(onCompleteAction); tween = SetEase(tween, ease); return(tween); }
public LTSeq append(LTDescr tween) { this.current.tween = tween; this.current.totalDelay = this.addPreviousDelays(); tween.setDelay(this.current.totalDelay); return(this.addOn()); }
public LTSeq append(LTDescr tween) { current.tween = tween; current.totalDelay = addPreviousDelays(); tween.setDelay(current.totalDelay); return(addOn()); }
void Start() { LTDescr ltDescr = LeanTween.rotateAroundLocal(gameObject, axis, add, time); ltDescr.setDelay(delay); ltDescr.setRepeat(repeat); ltDescr.setDestroyOnComplete(destroyOnComplete); }
private void PlayMoveLocalYAnimation(float toY, float time, float delay) { LTDescr ltDescr = LeanTween.moveLocalY(gameObject, toY, time); ltDescr.tweenType = LeanTweenType.linear; ltDescr.setIgnoreTimeScale(true); ltDescr.setDelay(delay); }
public LTSeq insert(LTDescr tween) { this.current.tween = tween; tween.setDelay(addPreviousDelays()); return(addOn()); }
private void PlayScaleAnimation(float toSale, float time, float delay) { Vector2 toScaleVector = new Vector2(toSale, toSale); LTDescr ltDescr = LeanTween.scale(gameObject, toScaleVector, time); ltDescr.tweenType = LeanTweenType.easeInOutSine; ltDescr.setIgnoreTimeScale(true); ltDescr.setDelay(delay); }
public void Execute() { switch (tweenType) { case TweenType.Move: { descr = LeanTween.move(gameObject, to, duration); } break; case TweenType.MoveX: { descr = LeanTween.moveX(gameObject, toX, duration); } break; case TweenType.MoveY: { descr = LeanTween.moveY(gameObject, toY, duration); } break; case TweenType.Scale: { descr = LeanTween.scale(gameObject, to, duration); } break; case TweenType.ScaleX: { descr = LeanTween.scaleX(gameObject, toX, duration); } break; case TweenType.ScaleY: { descr = LeanTween.scaleY(gameObject, toY, duration); } break; case TweenType.Rotate: { descr = LeanTween.rotate(gameObject, new Vector3(0, 0, rotation), duration); } break; } descr.setDelay(delay).setEase(easeType); if (loop) { descr.loopCount = int.MaxValue; } if (pingpong) { descr.setLoopPingPong(); } }
public void startAction() { _canvasGroup.alpha = fromAlpha; LTDescr ltDescr = LeanTween.value(gameObject, fromAlpha, toAlpha, time); ltDescr.setDelay(delay); ltDescr.setEase(LeanTweenType.easeInOutSine); ltDescr.setOnUpdate(OnUpdateFloat); }
public void StartAction() { rectTransform.anchoredPosition = initialAnchoredPosition; LTDescr ltDescr = LeanTween.value(gameObject, initialAnchoredPosition, Vector2.zero, time); ltDescr.tweenType = LeanTweenType.easeInOutSine; ltDescr.setDelay(delay); ltDescr.setOnUpdateVector2(OnUpdateAnchoredPosition); }
private void PlayAlphaAnimation(float toAlpha, float time, float delay) { LTDescr ltDescr = LeanTween.value(gameObject, 1, toAlpha, time); ltDescr.tweenType = LeanTweenType.easeInOutSine; ltDescr.setIgnoreTimeScale(true); ltDescr.setOnUpdate(OnUpdateAlpha); ltDescr.setOnComplete(OnAlphaAnimationComplemte); ltDescr.setDelay(delay); }
private void AnimateScale(Vector3 fromScale, Vector3 toScale, float delayTime) { if (startPositionOffset) { objectToAnimate.GetComponent <RectTransform>().localScale = fromScale; } tweenObject = LeanTween.scale(objectToAnimate, toScale, duration); tweenObject.setDelay(delayTime); tweenObject.setEase(easeType); }
public void StartAction() { _canvasGroup.alpha = 0f; LTDescr ltDescr = LeanTween.value(gameObject, 0, 1, time); ltDescr.setDelay(delay); ltDescr.setEase(LeanTweenType.easeInOutSine); ltDescr.setOnUpdate(OnUpdateFloat); ltDescr.setIgnoreTimeScale(true); }
void Start() { LTDescr ltDescr = LeanTween.value(gameObject, colorFrom, colorTo, time); ltDescr.setDelay(delay); ltDescr.loopType = LeanTweenType.pingPong; ltDescr.setOnUpdateColor(OnUpdateColor); ltDescr.setDestroyOnComplete(destroyOnComplete); ltDescr.setRepeat(repeatTimes); }
public void AnimateMovement(Vector3 fromMovement, Vector3 toMovement, float delayTime) { AssignObjectToAnimate(); RectTransform rectTransform = objectToAnimate.GetComponent <RectTransform>(); rectTransform.anchoredPosition = fromMovement; tweenObject = LeanTween.move(rectTransform, toMovement, duration); tweenObject.setDelay(delayTime); tweenObject.setEase(easeType); }
// Use this for initialization void Start() { LTDescr tween = LeanTween.move(this.gameObject, new Vector3(0, 3, 0), 3); tween.setFrom(new Vector3(0, -5, 0)); tween.setDelay(2); tween.setEase(LeanTweenType.easeInBounce); tween.setOnUpdate(EscreveValor); tween.setEase(LeanTweenType.easeOutQuad); }
/** * Retrieve a sequencer object where you can easily chain together tweens and methods one after another * * @method add (tween) * @return {LTSeq} LTSeq an object that you can add tweens, methods and time on to * @example * var seq = LeanTween.sequence();<br> * seq.append( LeanTween.move(cube1, Vector3.one * 10f, 1f) ); // do a move tween<br> * seq.append( LeanTween.rotateAround( avatar1, Vector3.forward, 360f, 1f ) ); // then do a rotate tween<br> */ public LTSeq append(LTDescr tween) { this.current.tween = tween; // Debug.Log("tween:" + tween + " delay:" + this.current.totalDelay); this.current.totalDelay = addPreviousDelays(); tween.setDelay(this.current.totalDelay); return(addOn()); }
public void Init() { // Debug.Log("Initializing " + target.gameObject.name + "\n"); if (target == null) { Debug.Log("Missing target for " + this.gameObject.name + " LeanTweener\n"); return; } LTDescr l = null; LeanTween.cancel(target); switch (type) { case TweenType.Scale: target.transform.localScale = init_vector; l = LeanTween.scale(target, vector, time).setIgnoreTimeScale(ignoreTimeScale); break; case TweenType.Rotate: l = LeanTween.rotateZ(target, value, time).setIgnoreTimeScale(ignoreTimeScale); break; case TweenType.ColorChange: l = LeanTween.color(target, my_color, time).setIgnoreTimeScale(ignoreTimeScale); break; default: return; } tweening = true; if (delay > 0) { l.setDelay(delay); } if (leantweentype != LeanTweenType.notUsed) { l.setEase(leantweentype); } if (pingpong > -99) { l.setLoopPingPong(pingpong); } if (duration != -99) { StartCoroutine(StopMeSoon()); } }
public void Show() { rect = GetComponent <RectTransform>(); canvasGroup = GetComponent <CanvasGroup>(); if (objectToAnimate == null) { objectToAnimate = gameObject; } switch (transitionType) { case UITransitionType.Move: Move(); break; case UITransitionType.Scale: Scale(); break; case UITransitionType.Fade: Fade(); break; } tweenObject.setDelay(delay); tweenObject.setEase(easeType); tweenObject.setIgnoreTimeScale(true); if (loop) { tweenObject.loopCount = int.MaxValue; } if (pingpong) { tweenObject.setLoopPingPong(); } }
// Code that runs on entering the state. public override void OnEnter() { var len = pathPoints.Length; Vector3[] tweenVector = new Vector3[len]; for (var i = 0; i < len; i++) { tweenVector [i] = pathPoints [i].Value; } GameObject go = Fsm.GetOwnerDefaultTarget(gameObject); Fsm.Event(onStartEvent); LTDescr tween = LeanTween.move(go, tweenVector, time.Value); LeanTweenID.Value = tween.id; tween.setOrientToPath(orientToPath.Value); tween.setAxis(axis.Value); tween.setEase(easeType); tween.setDelay(delay.Value); if (noOfRepeat.Value > 0) { tween.setRepeat(noOfRepeat.Value); } switch (LoopType) { case LTLoop.clamp: tween.setLoopClamp(); break; case LTLoop.once: tween.setLoopOnce(); break; case LTLoop.pingpong: tween.setLoopPingPong(); break; } tween.setOnComplete(doOnComplete); tween.setOnUpdate(doOnUpdate); tween.setUseEstimatedTime(useEstimatedTime.Value); tween.setUseFrames(useFrames.Value); }
// Code that runs on entering the state. public override void OnEnter() { GameObject go = Fsm.GetOwnerDefaultTarget(gameObject); GameObject tGo = targetGameObject.Value; if (tGo != null) { tempVector = tGo.transform.position; } else { tempVector = vector.Value; } Fsm.Event(onStartEvent); LTDescr tween = LeanTween.move(go, tempVector, time.Value); LeanTweenID.Value = tween.id; tween.setEase(easeType); tween.setDelay(delay.Value); if (noOfRepeat.Value > 0) { tween.setRepeat(noOfRepeat.Value); } switch (LoopType) { case LTLoop.clamp: tween.setLoopClamp(); break; case LTLoop.once: tween.setLoopOnce(); break; case LTLoop.pingpong: tween.setLoopPingPong(); break; } tween.setOnComplete(doOnComplete); tween.setOnUpdate(doOnUpdate); tween.setUseEstimatedTime(useEstimatedTime.Value); tween.setUseFrames(useFrames.Value); }
private void PlayDebutAnimation(GameObject contentItemGameObject, float delay, bool isLast) { float startY = contentItemGameObject.transform.localPosition.y - scrollRect.GetComponent <RectTransform>().rect.size.y; Vector3 startLocalPosition = contentItemGameObject.transform.localPosition; startLocalPosition.y = startY; float endY = contentItemGameObject.transform.localPosition.y; contentItemGameObject.transform.localPosition = startLocalPosition; LTDescr ltDescr = LeanTween.moveLocalY(contentItemGameObject, endY, 0.6f); ltDescr.tweenType = LeanTweenType.easeInSine; ltDescr.setDelay(delay + _shouldPlayInitAnimationDelay); if (isLast) { ltDescr.setOnComplete(OnInitComplete); } }
public void HandleTween() { if (ObjectToAnimate == null) { ObjectToAnimate = gameObject; } switch (AnimationType) { case UIAnimationTypes.Fade: Fade(); break; case UIAnimationTypes.Move: MoveAbsolute(); break; case UIAnimationTypes.Scale: Scale(); break; case UIAnimationTypes.ScaleX: Scale(); break; case UIAnimationTypes.ScaleY: Scale(); break; } _tweenObject.setDelay(Delay); _tweenObject.setEase(EaseType); if (Loop) { _tweenObject.loopCount = int.MaxValue; } if (PingPong) { _tweenObject.setLoopPingPong(); } }
public void HandleTween() { if (_objectToAnimate == null) { _objectToAnimate = gameObject; } switch (animationType) { case AnimationType.MOVE: MoveAbsolute(); break; case AnimationType.SCALE: Scale(); break; case AnimationType.SCALEX: Scale(); break; case AnimationType.SCALEY: Scale(); break; default: throw new ArgumentOutOfRangeException(); } _tweenObject.setDelay(delay); _tweenObject.setEase(easeType); if (loop) { _tweenObject.loopCount = int.MaxValue; } if (pingpong) { _tweenObject.setLoopPingPong(); } }
protected virtual void ApplyAdditionalSettings(LTDescr tween) { tween.setDelay(animationSettings.Delay) .setIgnoreTimeScale(animationSettings.IgnoreTimeScale); if (animationSettings.Easing == LeanTweenType.animationCurve) { tween.setEase(animationSettings.AnimationCurve); } else { tween.setEase(animationSettings.Easing); } if (animationSettings.Loop) { tween.setLoopCount(animationSettings.Loops); tween.setLoopType(animationSettings.LoopType); } }
// Code that runs on entering the state. public override void OnEnter() { GameObject go = Fsm.GetOwnerDefaultTarget(gameObject); Vector3 final = go.transform.localPosition + vector.Value; Fsm.Event(onStartEvent); LTDescr tween = LeanTween.moveLocal(go, final, time.Value); LeanTweenID.Value = tween.id; tween.setEase(easeType); tween.setDelay(delay.Value); if (noOfRepeat.Value > 0) { tween.setRepeat(noOfRepeat.Value); } switch (LoopType) { case LTLoop.clamp: tween.setLoopClamp(); break; case LTLoop.once: tween.setLoopOnce(); break; case LTLoop.pingpong: tween.setLoopPingPong(); break; } tween.setOnComplete(doOnComplete); tween.setOnUpdate(doOnUpdate); tween.setUseEstimatedTime(useEstimatedTime.Value); tween.setUseFrames(useFrames.Value); }
private void SetTweenSettings() { if (!LeanTween.isTweening(id)) { return; } LTDescr descr = LeanTween.descr(id); if (descr == null) { return; } if (easeType == LeanTweenType.animationCurve) { descr.setEase(animationCurve); } else { descr.setEase(easeType); } descr.setDelay(delay); if (loop) { if (pingPong) { descr.setLoopPingPong(loopTimes); } else { descr.setLoopClamp(loopTimes); } } descr.setOnComplete(() => onCompleteCallback?.Invoke()); descr.setDestroyOnComplete(destroyOnComplete); }
// Code that runs on entering the state. public override void OnEnter() { GameObject go = Fsm.GetOwnerDefaultTarget(gameObject); float final = go.transform.eulerAngles.x + degrees.Value; Fsm.Event(onStartEvent); LTDescr tween = LeanTween.rotate(go.GetComponent <RectTransform>(), final, time.Value); LeanTweenID.Value = tween.id; tween.setEase(easeType); tween.setDelay(delay.Value); if (noOfRepeat.Value > 0) { tween.setRepeat(noOfRepeat.Value); } switch (LoopType) { case LTLoop.clamp: tween.setLoopClamp(); break; case LTLoop.once: tween.setLoopOnce(); break; case LTLoop.pingpong: tween.setLoopPingPong(); break; } tween.setOnComplete(doOnComplete); tween.setUseEstimatedTime(useEstimatedTime.Value); tween.setUseFrames(useFrames.Value); }