_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/RacingPanel/MoveBg.cs

28 lines
651 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
public class MoveBg : MonoBehaviour
{
public static MoveBg instance;
public RectTransform rectTransform;
public Vector2 orginPos;
private float moveX = 1372;
// Start is called before the first frame update
void Start()
{
orginPos = rectTransform.anchoredPosition;
instance = this;
}
public void StartMove()//¿ªÊ¼Òƶ¯
{
rectTransform.DOAnchorPosX(-moveX*2,10).SetEase(Ease.Linear);
}
public void ReturnPos()//¹éλ
{
rectTransform.anchoredPosition = orginPos;
}
}