void Start() { // Time.timeScale = 1f/4f; // *********** Main Window ********** // Scale the whole window in mainWindow.localScale = Vector3.zero; LeanTween.scale(mainWindow, new Vector3(1f, 1f, 1f), 0.6f).setEase(LeanTweenType.easeOutBack); LeanTween.alphaCanvas(mainWindow.GetComponent <CanvasGroup>(), 0f, 1f).setDelay(2f).setLoopPingPong().setRepeat(2); // Fade the main paragraph in while moving upwards mainParagraphText.anchoredPosition3D += new Vector3(0f, -10f, 0f); LeanTween.textAlpha(mainParagraphText, 0f, 0.6f).setFrom(0f).setDelay(0f); LeanTween.textAlpha(mainParagraphText, 1f, 0.6f).setEase(LeanTweenType.easeOutQuad).setDelay(0.6f); LeanTween.move(mainParagraphText, mainParagraphText.anchoredPosition3D + new Vector3(0f, 10f, 0f), 0.6f).setEase(LeanTweenType.easeOutQuad).setDelay(0.6f); // Flash text to purple and back LeanTween.textColor(mainTitleText, new Color(133f / 255f, 145f / 255f, 223f / 255f), 0.6f).setEase(LeanTweenType.easeOutQuad).setDelay(0.6f).setLoopPingPong().setRepeat(-1); // Fade button in LeanTween.textAlpha(mainButton2, 1f, 2f).setFrom(0f).setDelay(0f).setEase(LeanTweenType.easeOutQuad); LeanTween.alpha(mainButton2, 1f, 2f).setFrom(0f).setDelay(0f).setEase(LeanTweenType.easeOutQuad); // *********** Pause Button ********** // Drop pause button in pauseWindow.anchoredPosition3D += new Vector3(0f, 200f, 0f); LeanTween.moveY(pauseWindow, pauseWindow.anchoredPosition3D.y + -200f, 0.6f).setEase(LeanTweenType.easeOutSine).setDelay(0.6f); // Punch Pause Symbol RectTransform pauseText = pauseWindow.Find("PauseText").GetComponent <RectTransform>(); LeanTween.moveZ(pauseText, pauseText.anchoredPosition3D.z - 80f, 1.5f).setEase(LeanTweenType.punch).setDelay(2.0f); // Rotate rings around in opposite directions LeanTween.rotateAroundLocal(pauseRing1, Vector3.forward, 360f, 12f).setRepeat(-1); LeanTween.rotateAroundLocal(pauseRing2, Vector3.forward, -360f, 22f).setRepeat(-1); // *********** Chat Window ********** // Flip the chat window in chatWindow.RotateAround(chatWindow.position, Vector3.up, -180f); LeanTween.rotateAround(chatWindow, Vector3.up, 180f, 2f).setEase(LeanTweenType.easeOutElastic).setDelay(1.2f); // Play a series of sprites on the window on repeat endlessly LeanTween.play(chatRect, chatSprites).setLoopPingPong(); // Animate the bar up and down while changing the color to red-ish LeanTween.color(chatBar2, new Color(248f / 255f, 67f / 255f, 108f / 255f, 0.5f), 1.2f).setEase(LeanTweenType.easeInQuad).setLoopPingPong().setDelay(1.2f); LeanTween.scale(chatBar2, new Vector2(1f, 0.7f), 1.2f).setEase(LeanTweenType.easeInQuad).setLoopPingPong(); // Write in paragraph text string origText = chatText.text; chatText.text = ""; LeanTween.value(gameObject, 0, (float)origText.Length, 6f).setEase(LeanTweenType.easeOutQuad).setOnUpdate((float val) => { chatText.text = origText.Substring(0, Mathf.RoundToInt(val)); }).setLoopClamp().setDelay(2.0f); }
private IEnumerator IAnimateMenuCharacters() { var titleAniamtionImageRectTransform = TitleAnimationImage.GetComponent <RectTransform>(); LeanTween.play( titleAniamtionImageRectTransform, TitleCharacterAnimationSprites) .setSpeed(10); yield return(null); }
//LeanTween.play public static LTDescr LeanPlay(this RectTransform rectTransform, UnityEngine.Sprite[] sprites) { return(LeanTween.play(rectTransform, sprites)); }
private void buildTween(LeanTweenItem item, float delayAdd, bool generateCode) { float delay = item.delay + delayAdd; bool code = generateCode; float d = item.duration; // Debug.Log("item:"+item.action); if (item.action == TweenAction.ALPHA) { tween = code ? append("alpha", item.to.x, d) : LeanTween.alpha(gameObject, item.to.x, d); } else if (item.action == TweenAction.ALPHA_VERTEX) { tween = code ? append("alphaVertex", item.to.x, d) : LeanTween.alphaVertex(gameObject, item.to.x, d); } else if (item.action == TweenAction.MOVE) { tween = code ? append("move", item.to, d) : LeanTween.move(gameObject, item.to, d); } else if (item.action == TweenAction.MOVE_LOCAL) { tween = code ? append("moveLocal", item.to, d) : LeanTween.moveLocal(gameObject, item.to, d); } else if (item.action == TweenAction.MOVE_LOCAL_X) { tween = code ? append("moveLocalX", item.to.x, d) : LeanTween.moveLocalX(gameObject, item.to.x, d); } else if (item.action == TweenAction.MOVE_LOCAL_Y) { tween = code ? append("moveLocalY", item.to.x, d) : LeanTween.moveLocalY(gameObject, item.to.x, d); } else if (item.action == TweenAction.MOVE_LOCAL_Z) { tween = code ? append("moveLocalZ", item.to.x, d) : LeanTween.moveLocalZ(gameObject, item.to.x, d); } else if (item.action == TweenAction.MOVE_X) { tween = code ? append("moveX", item.to.x, d) : LeanTween.moveX(gameObject, item.to.x, d); } else if (item.action == TweenAction.MOVE_Y) { tween = code ? append("moveY", item.to.x, d) : LeanTween.moveY(gameObject, item.to.x, d); } else if (item.action == TweenAction.MOVE_Z) { tween = code ? append("moveZ", item.to.x, d) : LeanTween.moveZ(gameObject, item.to.x, d); } else if (item.action == TweenAction.MOVE_CURVED) { tween = code ? append("move", item.bezierPath ? item.bezierPath.vec3 : null, d) : LeanTween.move(gameObject, item.bezierPath.vec3, d); if (item.orientToPath) { if (code) { codeBuild.Append(".setOrientToPath(" + item.orientToPath + ")"); } else { tween.setOrientToPath(item.orientToPath); } } if (item.isPath2d) { if (code) { codeBuild.Append(".setOrientToPath2d(true)"); } else { tween.setOrientToPath2d(item.isPath2d); } } } else if (item.action == TweenAction.MOVE_CURVED_LOCAL) { tween = code ? append("moveLocal", item.bezierPath ? item.bezierPath.vec3 : null, d) : LeanTween.moveLocal(gameObject, item.bezierPath.vec3, d); if (item.orientToPath) { if (code) { codeBuild.Append(".setOrientToPath(" + item.orientToPath + ")"); } else { tween.setOrientToPath(item.orientToPath); } } if (item.isPath2d) { if (code) { codeBuild.Append(".setOrientToPath2d(true)"); } else { tween.setOrientToPath2d(item.isPath2d); } } } else if (item.action == TweenAction.MOVE_SPLINE) { tween = code ? append("moveSpline", item.splinePath ? item.splinePath.splineVector() : null, d) : LeanTween.moveSpline(gameObject, item.splinePath.splineVector(), d); if (item.orientToPath) { if (code) { codeBuild.Append(".setOrientToPath(" + item.orientToPath + ")"); } else { tween.setOrientToPath(item.orientToPath); } } if (item.isPath2d) { if (code) { codeBuild.Append(".setOrientToPath2d(true)"); } else { tween.setOrientToPath2d(item.isPath2d); } } } else if (item.action == TweenAction.ROTATE) { tween = code ? append("rotate", item.to, d) : LeanTween.rotate(gameObject, item.to, d); } else if (item.action == TweenAction.ROTATE_AROUND) { if (generateCode) { codeBuild.Append(tabs + "LeanTween.rotateAround(gameObject, " + vecToStr(item.axis) + ", " + item.to.x + "f , " + d + "f)"); } else { tween = LeanTween.rotateAround(gameObject, item.axis, item.to.x, d); } } else if (item.action == TweenAction.ROTATE_AROUND_LOCAL) { if (generateCode) { codeBuild.Append(tabs + "LeanTween.rotateAroundLocal(gameObject, " + vecToStr(item.axis) + ", " + item.to.x + "f , " + d + "f)"); } else { tween = LeanTween.rotateAroundLocal(gameObject, item.axis, item.to.x, d); } } else if (item.action == TweenAction.ROTATE_LOCAL) { tween = code ? append("rotateLocal", item.to, d) : LeanTween.rotateLocal(gameObject, item.to, d); } else if (item.action == TweenAction.ROTATE_X) { tween = code ? append("rotateX", item.to.x, d) : LeanTween.rotateX(gameObject, item.to.x, d); } else if (item.action == TweenAction.ROTATE_Y) { tween = code ? append("rotateY", item.to.x, d) : LeanTween.rotateY(gameObject, item.to.x, d); } else if (item.action == TweenAction.ROTATE_Z) { tween = code ? append("rotateZ", item.to.x, d) : LeanTween.rotateZ(gameObject, item.to.x, d); } else if (item.action == TweenAction.SCALE) { tween = code ? append("scale", item.to, d) : LeanTween.scale(gameObject, item.to, d); } else if (item.action == TweenAction.SCALE_X) { tween = code ? append("scaleX", item.to.x, d) : LeanTween.scaleX(gameObject, item.to.x, d); } else if (item.action == TweenAction.SCALE_Y) { tween = code ? append("scaleY", item.to.x, d) : LeanTween.scaleY(gameObject, item.to.x, d); } else if (item.action == TweenAction.SCALE_Z) { tween = code ? append("scaleZ", item.to.x, d) : LeanTween.scaleZ(gameObject, item.to.x, d); } #if !UNITY_4_3 && !UNITY_4_5 else if (item.action == TweenAction.CANVAS_MOVE) { tween = code ? appendRect("move", item.to, d) : LeanTween.move(GetComponent <RectTransform>(), item.to, d); } else if (item.action == TweenAction.CANVAS_SCALE) { tween = code ? appendRect("scale", item.to, d) : LeanTween.scale(GetComponent <RectTransform>(), item.to, d); } else if (item.action == TweenAction.CANVAS_ROTATEAROUND) { if (generateCode) { codeBuild.Append(tabs + "LeanTween.rotateAround(rectTransform, " + vecToStr(item.axis) + ", " + item.to.x + "f , " + d + "f)"); } else { tween = LeanTween.rotateAround(GetComponent <RectTransform>(), item.axis, item.to.x, d); } } else if (item.action == TweenAction.CANVAS_ROTATEAROUND_LOCAL) { if (generateCode) { codeBuild.Append(tabs + "LeanTween.rotateAroundLocal(rectTransform, " + vecToStr(item.axis) + ", " + item.to.x + "f , " + d + "f)"); } else { tween = LeanTween.rotateAroundLocal(GetComponent <RectTransform>(), item.axis, item.to.x, d); } } else if (item.action == TweenAction.CANVAS_ALPHA) { tween = code ? appendRect("alpha", item.to.x, d) : LeanTween.alpha(GetComponent <RectTransform>(), item.to.x, d); } else if (item.action == TweenAction.CANVAS_COLOR) { tween = code ? appendRect("color", item.colorTo, d) : LeanTween.color(GetComponent <RectTransform>(), item.colorTo, d); } else if (item.action == TweenAction.TEXT_ALPHA) { tween = code ? appendRect("textAlpha", item.to.x, d) : LeanTween.textAlpha(GetComponent <RectTransform>(), item.to.x, d); } else if (item.action == TweenAction.TEXT_COLOR) { tween = code ? appendRect("textColor", item.colorTo, d) : LeanTween.textColor(GetComponent <RectTransform>(), item.colorTo, d); } else if (item.action == TweenAction.CANVAS_PLAYSPRITE) { if (generateCode) { codeBuild.Append(tabs + "LeanTween.play(rectTransform, sprites).setFrameRate(" + item.frameRate + "f)"); } else { tween = LeanTween.play(GetComponent <RectTransform>(), item.sprites).setFrameRate(item.frameRate); } } #endif else if (item.action == TweenAction.COLOR) { tween = code ? append("color", item.colorTo, d) : LeanTween.color(gameObject, item.colorTo, d); } else if (item.action == TweenAction.DELAYED_SOUND) { if (generateCode) { codeBuild.Append(tabs + "LeanTween.delayedSound(gameObject, passAudioClipHere, " + vecToStr(item.from) + ", " + d + "f)"); } else { tween = LeanTween.delayedSound(gameObject, item.audioClip, item.from, item.duration); } } else { tween = null; Debug.Log("The tween '" + item.action.ToString() + "' has not been implemented. info item:" + item); return; } // Append Extras if (generateCode) { if (delay > 0f) { codeBuild.Append(".setDelay(" + delay + "f)"); } } else { tween = tween.setDelay(delay); } if (item.ease == LeanTweenType.animationCurve) { if (generateCode) { codeBuild.Append(".setEase("); append(item.animationCurve); codeBuild.Append(")"); } else { tween.setEase(item.animationCurve); } } else { if (generateCode) { if (item.ease != LeanTweenType.linear) { codeBuild.Append(".setEase(LeanTweenType." + item.ease + ")"); } } else { tween.setEase(item.ease); } } // Debug.Log("curve:"+item.animationCurve+" item.ease:"+item.ease); if (item.between == LeanTweenBetween.FromTo) { if (generateCode) { codeBuild.Append(".setFrom(" + item.from + ")"); } else { tween.setFrom(item.from); } } if (item.doesLoop) { if (generateCode) { codeBuild.Append(".setRepeat(" + item.loopCount + ")"); } else { tween.setRepeat(item.loopCount); } if (item.loopType == LeanTweenType.pingPong) { if (generateCode) { codeBuild.Append(".setLoopPingPong()"); } else { tween.setLoopPingPong(); } } } if (generateCode) { codeBuild.Append(";\n"); } }