1
0
mirror of https://github.com/Cardidi/dotween-upm-fork.git synced 2025-12-20 09:16:02 +08:00
dotween-upm-fork/Sources~/UnityTests.Unity5/Assets/_Tests/PortraitToLandscapeAtRuntime.cs
2020-01-17 00:11:15 +09:00

33 lines
699 B
C#

using UnityEngine;
using System.Collections;
using DG.Tweening;
public class PortraitToLandscapeAtRuntime : BrainBase
{
public RectTransform target;
Tween tween;
void Start()
{
CreateRTTween();
tween.Pause();
}
void OnGUI()
{
if (GUILayout.Button("Rewind")) DOTween.RewindAll();
if (GUILayout.Button("Restart")) tween.Restart();
if (GUILayout.Button("RT Recreate")) CreateRTTween();
if (GUILayout.Button("T Recreate")) CreateTween();
}
void CreateRTTween()
{
tween = target.DOAnchorPos(new Vector2(0, 50), 2).SetRelative().SetAutoKill(false);
}
void CreateTween()
{
tween = ((Transform)target).DOMove(new Vector2(0, 50), 2).SetRelative().SetAutoKill(false);
}
}