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(); } }
// 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 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); 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); }
// 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); }
// Code that runs on entering the state. public override void OnEnter() { GameObject go = Fsm.GetOwnerDefaultTarget(gameObject); Fsm.Event(onStartEvent); LTDescr tween = LeanTween.value(go, doOnUpdate, fromValue.Value, toValue.Value, 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 SetTweenType() { switch (TweenType) { case LeanTweenType.linear: mTweenDescriptor.setEaseLinear(); break; case LeanTweenType.easeOutQuad: mTweenDescriptor.setEaseOutQuad(); break; case LeanTweenType.easeInQuad: mTweenDescriptor.setEaseInQuad(); break; case LeanTweenType.easeInOutQuad: mTweenDescriptor.setEaseInOutQuad(); break; case LeanTweenType.easeInCubic: mTweenDescriptor.setEaseInCubic(); break; case LeanTweenType.easeOutCubic: mTweenDescriptor.setEaseOutCubic(); break; case LeanTweenType.easeInOutCubic: mTweenDescriptor.setEaseInOutCubic(); break; case LeanTweenType.easeInQuart: mTweenDescriptor.setEaseInQuart(); break; case LeanTweenType.easeOutQuart: mTweenDescriptor.setEaseOutQuart(); break; case LeanTweenType.easeInOutQuart: mTweenDescriptor.setEaseInOutQuart(); break; case LeanTweenType.easeInQuint: mTweenDescriptor.setEaseInQuint(); break; case LeanTweenType.easeOutQuint: mTweenDescriptor.setEaseOutQuint(); break; case LeanTweenType.easeInOutQuint: mTweenDescriptor.setEaseInOutQuint(); break; case LeanTweenType.easeInSine: mTweenDescriptor.setEaseInSine(); break; case LeanTweenType.easeOutSine: mTweenDescriptor.setEaseOutSine(); break; case LeanTweenType.easeInOutSine: mTweenDescriptor.setEaseInOutSine(); break; case LeanTweenType.easeInExpo: mTweenDescriptor.setEaseInExpo(); break; case LeanTweenType.easeOutExpo: mTweenDescriptor.setEaseOutExpo(); break; case LeanTweenType.easeInOutExpo: mTweenDescriptor.setEaseInOutExpo(); break; case LeanTweenType.easeInCirc: mTweenDescriptor.setEaseInCirc(); break; case LeanTweenType.easeOutCirc: mTweenDescriptor.setEaseOutCirc(); break; case LeanTweenType.easeInOutCirc: mTweenDescriptor.setEaseInOutCirc(); break; case LeanTweenType.easeInBounce: mTweenDescriptor.setEaseInBounce(); break; case LeanTweenType.easeOutBounce: mTweenDescriptor.setEaseOutBounce(); break; case LeanTweenType.easeInOutBounce: mTweenDescriptor.setEaseInOutBounce(); break; case LeanTweenType.easeInBack: mTweenDescriptor.setEaseInBack(); break; case LeanTweenType.easeOutBack: mTweenDescriptor.setEaseOutBack(); break; case LeanTweenType.easeInOutBack: mTweenDescriptor.setEaseInOutBack(); break; case LeanTweenType.easeInElastic: mTweenDescriptor.setEaseInElastic(); break; case LeanTweenType.easeOutElastic: mTweenDescriptor.setEaseOutElastic(); break; case LeanTweenType.easeInOutElastic: mTweenDescriptor.setEaseInOutElastic(); break; case LeanTweenType.easeSpring: mTweenDescriptor.setEaseSpring(); break; case LeanTweenType.easeShake: mTweenDescriptor.setEaseShake(); break; case LeanTweenType.punch: mTweenDescriptor.setEasePunch(); break; case LeanTweenType.once: mTweenDescriptor.setLoopOnce(); break; case LeanTweenType.clamp: mTweenDescriptor.setLoopClamp(); break; case LeanTweenType.pingPong: mTweenDescriptor.setLoopPingPong(); break; case LeanTweenType.animationCurve: Debug.LogError("Can't set AnimationCurve Tween this way..."); break; default: Debug.LogError("Invalid TweenType specified. Falling back to Linear"); break; } }