powerfun-unity/Assets/Scripts/UI/ButtonHoverScript.cs

36 lines
907 B
C#
Raw Normal View History

2021-04-06 15:30:36 +08:00
using DG.Tweening;
using System.Collections;
2021-03-25 16:55:36 +08:00
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class ButtonHoverScript : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler
{
public void OnPointerEnter(PointerEventData eventData)
{
2021-04-06 15:30:36 +08:00
//transform.DOMove
2021-04-23 09:22:12 +08:00
//Debug.Log("鼠标悬浮");
2021-04-06 15:30:36 +08:00
//gameObject.transform.localScale = new Vector3(1.01f, 1.01f, 1f);
transform.DOScale(new Vector3(1.01f, 1.01f, 1f),0.2f);
2021-03-25 16:55:36 +08:00
}
public void OnPointerExit(PointerEventData eventData)
{
2021-04-23 09:22:12 +08:00
//Debug.Log("鼠标松开");
2021-04-06 15:30:36 +08:00
transform.DOScale(new Vector3(1f, 1f, 1f), 0.2f);
//gameObject.transform.localScale = new Vector3(1f, 1f, 1f);
2021-03-25 16:55:36 +08:00
}
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}