// 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); }
private void ExecutarAnimacao() { LTDescr tween = LeanTween.scale(this.painel, Vector3.one, 0.35f); tween.setFrom(Vector3.one * 2); tween.setEase(LeanTweenType.easeOutBack); int pontuacao = ControladorPontuacao.GetPontuacao(); tween = LeanTween.value(0, pontuacao, 3); tween.setEase(LeanTweenType.easeOutCubic); tween.setOnUpdate(EscreveValor); }
//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(); } }
void ScaleButton(RectTransform rt, float t, float d, bool useButtonsEase = true) { LTDescr ltd = LeanTween.scale(rt, Vector3.one, t) .setIgnoreTimeScale(true) .setDelay(d); if (useButtonsEase) { ltd.setEase(LeanTweenType.easeOutCubic); } else { ltd.setEase(LeanTweenType.easeInOutCubic); } }
private void TaskShowEnd() { LTDescr tween = LeanTween.move(starTrans, new Vector3(-400, 815, 0), 0.3f); tween.delay = 0.3f; tween.setEase(LeanTweenType.easeInOutBack); LTDescr tween2 = LeanTween.move(stepTrans, new Vector3(440, 890, 0), 0.3f); tween2.delay = 0.3f; tween2.setEase(LeanTweenType.easeInOutBack); List <PropInfo> allProps = PropModel.Instance.allProps; bool hasOpen = false; int i; for (i = 0; i < allProps.Count; i++) { PropInfo propInfo = allProps[i]; if (propInfo.isForbid == false) { hasOpen = true; } } if (hasOpen) { LTDescr tween3 = LeanTween.move(propTrans, new Vector3(0, 0, 0), 0.25f); tween3.delay = 0.25f; tween3.setEase(LeanTweenType.easeInOutBack); } }
public int SlowdownBeforeCall() { var curDir = GetComponent <Rigidbody>().velocity.normalized; var curPos = transform.position; var newPos = new Vector3(curPos.x + curDir.x * 3f, curPos.y + curDir.y * 3f, 0); GetComponent <Rigidbody>().velocity = Vector3.zero; RotationsPerMinute = 0.2f; State = Sphere.SphereState.CallBall; // raycast RayT.LookAt(curDir, Vector3.up); RaycastHit hitInfo; if (Physics.Raycast(RayT.position, curDir, out hitInfo, 4f)) { var x = (curDir.x > 0) ? 0.25f : -0.25f; var y = (curDir.y > 0) ? 0.25f : -0.25f; newPos = new Vector3(curPos.x + x, curPos.y + y, 0f); } _ltSlowdown = LeanTween.move(gameObject, newPos, 2f); _ltSlowdown.setEase(LeanTweenType.easeOutBack); return(_ltSlowdown.id); }
private void demoEaseTypes(){ for(int i = 0; i < easeTypes.Length; i++){ string easeName = easeTypes[i]; Transform obj1 = GameObject.Find(easeName).transform.Find("Line"); float obj1val = 0f; LTDescr lt = LeanTween.value( obj1.gameObject, 0f, 1f, 5f).setOnUpdate( (float val)=>{ Vector3 vec = obj1.localPosition; vec.x = obj1val*lineDrawScale; vec.y = val*lineDrawScale; obj1.localPosition = vec; obj1val += Time.deltaTime/5f; if(obj1val>1f) obj1val = 0f; }); if(easeName.IndexOf("AnimationCurve")>=0){ lt.setEase(animationCurve); }else{ MethodInfo theMethod = lt.GetType().GetMethod("set"+easeName); theMethod.Invoke(lt, null); } if (easeName.IndexOf("EasePunch") >= 0) { lt.setScale(1f); } else if (easeName.IndexOf("EaseOutBounce") >= 0) { lt.setOvershoot(2f); } } LeanTween.delayedCall(gameObject, 10f, resetLines); LeanTween.delayedCall(gameObject, 10.1f, demoEaseTypes); }
public override void OnEnter() { if (_targetObject.Value == null) { Continue(); return; } if (stopPreviousTweens) { LeanTween.cancel(_targetObject.Value); } ourTween = ExecuteTween(); ourTween.setEase(easeType); if (waitUntilFinished) { if (ourTween != null) { ourTween.setOnComplete(OnTweenComplete); } } else { Continue(); } }
private void ShowSelectedCountry() { foreach (Transform t in transform) { if (t.gameObject.name == Country) { _countryObject = t.gameObject; break; } } var camPos = Camera.main.transform.position; var globePos = transform.position; var countryPos = transform.position - transform.TransformPoint(_countryObject.transform.position); _rotationAngle = GetAngleOfRotationByDirections( new Vector2(camPos.x, camPos.z), new Vector2(globePos.x, globePos.z), new Vector2(countryPos.x, countryPos.z) ); var aBitToTheSide = 20f; LTDescr ltRotate = LeanTween.rotateY(gameObject, _rotationAngle + aBitToTheSide, 5f); ltRotate.setEase(LeanTweenType.easeInOutBack); LeanTween.move(gameObject, new Vector3(-0.3f, 0.35f, -2.35f), 4f); }
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(); } }
public void startAction() { _canvasGroup.alpha = fromAlpha; LTDescr ltDescr = LeanTween.value(gameObject, fromAlpha, toAlpha, time); ltDescr.setDelay(delay); ltDescr.setEase(LeanTweenType.easeInOutSine); ltDescr.setOnUpdate(OnUpdateFloat); }
private void Close() { closeTween = LeanTween.rotateY(gameObject, startAngle, closeTime); closeTween.setEase(LeanTweenType.easeOutElastic); closeTween.setOnComplete(() => { animating = false; }); }
private void TaskTipEnd() { LTDescr tween = LeanTween.move(taskTrans, new Vector3(0, 900, 0), 0.3f); tween.delay = 0.2f; tween.setEase(LeanTweenType.easeInOutBack); tween.onComplete = TaskShowEnd; }
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 virtual void OnPointerClick(PointerEventData eventData) { Vector3 tweenTo = mIsSmall ? new Vector3(1f, 1f, 0f) : new Vector3(.5f, .5f, 0f); mIsSmall = !mIsSmall; mIsLocked = true; LTDescr desc = LeanTween.scale(gameObject, tweenTo, .5f) .setOnComplete(() => mIsLocked = false); LTDescr finalDesc = type == LeanTweenType.animationCurve ? desc.setEase(CustomCurve) : desc.setEase(type); }
// Use this for initialization void Start() { if (_rectTransform == null) { return; } LTDescr ltDescr = LeanTween.scale(_rectTransform, new Vector3(1f, 1f, 1f), 0.3f); ltDescr.setEase(LeanTweenType.easeSpring); }
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); }
/// <summary> /// Fades out the label. /// </summary> void FadeOut() { /*TweenColor tc = TweenColor.Begin(gameObject, fadeOutDuration, ec); * tc.from = sc; * tc.method = method;*/ LTDescr t = LeanTween.textAlpha(rect, 0, fadeInDuration); t.setFrom(1); t.setEase(easing); }
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); }
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); } }
private LTDescr ApplySettingsToTween(LTDescr tween) { if (_data.useCurve) { tween.setEase(_data.curve); } if (_loopPingPong) { tween.setLoopPingPong(); } return(tween); }
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); }
private void Start() { int highScore = PlayerPrefs.GetInt("highScore", 0); int lastScore = PlayerPrefs.GetInt("lastScore", 0) + PlayerPrefs.GetInt("coins", 0); this.highScoreText.text = highScore.ToString(); this.lastScoreText.text = lastScore.ToString(); PlayerPrefs.SetInt("coins", 0); LTDescr tween = LeanTween.scale(this.gameOverText.gameObject, Vector3.one, 0.15f); tween.setEase(LeanTweenType.easeInOutQuad); tween.setFrom((Vector3.one * 3f)); }
private void OnBlankClick(GameObject go) { if (configItem.next_id == 0) { EventTriggerListener.Get(blackTrans.gameObject).onClick = null; LTDescr tween = LeanTween.move(chartTrans, new Vector3(0, 1000, 0), 0.4f); tween.setEase(LeanTweenType.easeInOutBack); tween.onComplete = ComleteGuide; } else { ComleteGuide(); } }
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); }
public void Open(bool inWards) { if (animating) { return; } animating = true; //play doorbell sound AudioManager.instance?.Play3DSound(AudioEffect.doorbell, 1, transform.position); openTween = LeanTween.rotateY(gameObject, startAngle + maxAngle * (inWards ? -1 : 1), openTime); openTween.setEase(LeanTweenType.easeOutCirc); openTween.setOnComplete(() => { Close(); }); }
public void HandleTween() { switch (animationType) { case UIAnimationType.Move: MoveAbsolute(); break; case UIAnimationType.Scale: Scale(); break; } _tweenObject.setEase(easeType); }
void Start() { velocity = new Vector2(Random.Range(-3f, 3f), Random.Range(2f, 4f)); //The current lean tween animation being created. LTDescr mLeanTweenDescr = LeanTween.alpha(gameObject, 0, 1); mLeanTweenDescr.setEase(LeanTweenType.easeInCubic); mLeanTweenDescr.setOnComplete(() => { Destroy(gameObject); }); mLeanTweenActiveAnimID1 = mLeanTweenDescr.id; }
public void MoveTowards(GridPosition target) { if (MovementLeft <= 0) { if (selection == this) selection = null; return; } var lookPos = target.GetWorldPos(); lookPos.y = transform.position.y; transform.LookAt(lookPos); path = GamePlay.Instance.grid.FindPath(Position, target); if (path.Count > 0) { if (tween != null) LeanTween.cancel(gameObject); SetUsedMovementPoint(usedMovementPoints + 1); tween = LeanTween.move(gameObject, path[0].GetWorldPos(), moveTime); tween.setEase(LeanTweenType.easeInOutQuad); Position.occupant = null; Position = path[0]; Position.occupant = gameObject; pathIndex = 0; tween.onComplete = () => { OnCompletePathStep(); } ; if (moveParticles) moveParticles.Play(); SoundManager.Instance.PlaySound(moveSound); } }
void OnCompletePathStep() { pathIndex++; if (pathIndex < path.Count && GamePlay.Instance.CurrentPlayer != null && GamePlay.Instance.CurrentPlayer.characters.Contains(this) && GamePlay.Instance.State == GamePlay.GameplayState.Playing && MovementLeft > 0) { var target = path[pathIndex]; if (target.occupant != null) { path = null; return; } if (tween != null) LeanTween.cancel(gameObject); var targetPos = target.GetWorldPos(); tween = LeanTween.move(gameObject, target.GetWorldPos(), moveTime); tween.setEase(LeanTweenType.easeInOutQuad); Position.occupant = null; Position = path[pathIndex]; Position.occupant = gameObject; targetPos.y = transform.position.y; transform.LookAt(targetPos); SetUsedMovementPoint(usedMovementPoints + 1); tween.onComplete = OnCompletePathStep; if (moveParticles) moveParticles.Play(); SoundManager.Instance.PlaySound(moveSound); } else { path = null; } }
public void DoAnim() { Debug.Log("DoAnim "+gameObject.name); deamHandLTDesc = LeanTween.move(DemonHand, where2Go, timeToComplete); //deamHandLTDesc.setDestroyOnComplete(shouldDestroyOnComplete); deamHandLTDesc.setOnUpdate(OnUpdate); deamHandLTDesc.setOnComplete(nextStep); deamHandLTDesc.setEase(easyType); deamHandLTDesc.init(); }
public override void ActionStart() { tweenDescriptor = LeanTween.moveLocal(ActionObject, GetMoveToPosition(), MoveToActionData.time); tweenDescriptor.setEase(EaseType); tweenDescriptor.setOnComplete(OnFinish); }