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

28 lines
651 B
C#
Raw Normal View History

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()//<2F><>ʼ<EFBFBD>ƶ<EFBFBD>
{
rectTransform.DOAnchorPosX(-moveX*2,10).SetEase(Ease.Linear);
}
public void ReturnPos()//<2F><>λ
{
rectTransform.anchoredPosition = orginPos;
}
}