public async Task Hide() { MyTween.HideAlpha(_rootContainer, false, 0.8f); await Task.Delay(8000); gameObject.SetActive(false); }
IEnumerator FadeCoroutine(float fadeTimer, MyTween myTween) { OnStartFade(Color.black, fadeTimer); yield return(new WaitForSeconds(fadeTimer + 0.5f));//这里加0.5s是为了让这个动画看起来更舒服一些 myTween.HalfCompleteExcute(); OnStartFade(new Color(0, 0, 0, 0), fadeTimer / 2); myTween.IsComplete = true; myTween.CompleteExcute(); }
// Start is called before the first frame update void Start() { for (int i = 0; i < 10; i++) { int index = 0; index = i; MyTween tween = new MyTween(() => go = new GameObject()).SetDelay(2).OnComplete(() => go.name = index.ToString()); TweenManager.instance.Play(tween); } }
public void ReInitialize() { InitializeIfNeed(); MyTween.HideX(_userId, true, true); MyTween.HideX(_version, false, true); MyTween.HideAlpha(_productLogo, true); MyTween.HideAlpha(_tapToStart, true); MyTween.HideX(_copyright, false, true); _tapToStart.clicked += () => Hide(); }
private void OnEnable() { if (serializedObject != null) { _isScale = serializedObject.FindProperty("isScale"); _scaleCurve = serializedObject.FindProperty("Scale_curve"); _moveTime = serializedObject.FindProperty("Move_time"); _from = serializedObject.FindProperty("From"); _to = serializedObject.FindProperty("To"); _positionCurve = serializedObject.FindProperty("Position_curve"); } _myTween = target as MyTween; }
public async Task Show() { await Task.Delay(1000); MyTween.ShowX(_userId); MyTween.ShowX(_version); MyTween.ShowX(_copyright); await Task.Delay(500); MyTween.ShowAlpha(_productLogo, false, 1.2f, Ease.OutSine); await Task.Delay(1000); MyTween.ShowAlpha(_tapToStart, false, 1f); }
protected void DrawCommonProperties() { MyTween tw = target as MyTween; if (MyEditorTool.DrawHeader("Tweener")) { MyEditorTool.BeginContents(); EditorGUIUtility.labelWidth = 110f; GUI.changed = false; AnimationCurve curve = EditorGUILayout.CurveField("Animation Curve", tw.curve, GUILayout.Width(170f), GUILayout.Height(62f)); Style style = (Style)EditorGUILayout.EnumPopup("Play Style", tw.style); MoveType moveType = (MoveType)EditorGUILayout.EnumPopup("Play MoveType", tw.moveType); GUILayout.BeginHorizontal(); float dur = EditorGUILayout.FloatField("Duration", tw.duration, GUILayout.Width(170f)); GUILayout.Label("seconds"); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); float del = EditorGUILayout.FloatField("Start Delay", tw.delay, GUILayout.Width(170f)); GUILayout.Label("seconds"); GUILayout.EndHorizontal(); bool ts = EditorGUILayout.Toggle("Ignore TimeScale", tw.ignoreTimeScale); if (GUI.changed) { MyEditorTool.RegisterUndo("Tween Change", tw); tw.curve = curve; tw.moveType = moveType; tw.style = style; tw.ignoreTimeScale = ts; tw.duration = dur; tw.delay = del; MyEditorTool.SetDirty(tw); } MyEditorTool.EndContents(); } }
private void Awake() { m_SpriteRenderer = GetComponent <SpriteRenderer>(); m_MyTween = new MyTween(transform); }
void Update() { if (Controller.GetHairTriggerDown()) { CheckForInteractionObject(); } if (Controller.GetHairTrigger()) { if (objectBeingInteractedWith) { objectBeingInteractedWith.OnTriggerIsBeingPressed(this); } } if (Controller.GetHairTriggerUp()) { if (objectBeingInteractedWith) { objectBeingInteractedWith.OnTriggerWasReleased(this); objectBeingInteractedWith = null; } } //跳转显微镜场景 if (GameManager._Instance.isCanToMicroscope) { if (Controller.GetPressDown(SteamVR_Controller.ButtonMask.Axis0)) { MyTween myTween = new MyTween(); myTween.OnHalfComplete(() => { GameManager._Instance.isCanToMicroscope = false; GameManager._Instance.currentScenceID = ScenceID.Microscope; SceneManager.LoadScene("Microscope"); }); GameManager._Instance.PlayEffect(1); ScreenFade.Instance.SceneFade(myTween); } } //跳转实验室场景 if (GameManager._Instance.isCanTo2019) { if (Controller.GetPressDown(SteamVR_Controller.ButtonMask.Axis0)) { MyTween myTween = new MyTween(); myTween.OnHalfComplete(() => { GameManager._Instance.isCanTo2019 = false; GameManager._Instance.currentScenceID = ScenceID.Mian; SceneManager.LoadScene("2019"); }); GameManager._Instance.PlayEffect(1); ScreenFade.Instance.SceneFade(myTween); } } if (GameManager._Instance.isMicroscope) { if (Controller.GetPressDown(SteamVR_Controller.ButtonMask.Axis0)) { GameManager._Instance.isMicroscope = false; Microscope_Manager._Instance.Play(); } } }
/// <summary> /// 淡入淡出得转场效果 /// </summary> /// <param name="fadeTimer">淡入时间</param> public void SceneFade(MyTween myTween, float fadeTimer = 2f) { StartCoroutine(FadeCoroutine(fadeTimer, myTween)); }
public void _init(Transform transform) { m_MyTween = new MyTween(transform); }
public void MoveTo(Vector2 vector) // User should use ShowSlot after this method is done to replace the sprite { MyTween.InterpolateMethod(this, "ModifySpritePosition", initialPosition, initialPosition + vector, 0.5f); MyTween.Start(); }
public void Change(Element e) { MyTween.InterpolateMethod(this, nameof(ModifyColor), color, RayCircle.ELEMENT_COLORS[e], 0.5f); MyTween.Start(); }