powerfun-unity/Assets/Scripts/UI/ButtonHoverScript.cs
2021-04-23 09:22:12 +08:00

36 lines
907 B
C#

using DG.Tweening;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class ButtonHoverScript : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler
{
public void OnPointerEnter(PointerEventData eventData)
{
//transform.DOMove
//Debug.Log("鼠标悬浮");
//gameObject.transform.localScale = new Vector3(1.01f, 1.01f, 1f);
transform.DOScale(new Vector3(1.01f, 1.01f, 1f),0.2f);
}
public void OnPointerExit(PointerEventData eventData)
{
//Debug.Log("鼠标松开");
transform.DOScale(new Vector3(1f, 1f, 1f), 0.2f);
//gameObject.transform.localScale = new Vector3(1f, 1f, 1f);
}
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}