DoTween

/*

  • 项目:
  • 脚本:校园导航管理脚本
  • 脚本:此脚本挂载在SchoolMenuPanel上
  • 脚本:点击二级导航按钮,播放按钮动画(缩放),然后跳转相应面板
  • 企业:
  • 版本:1.0
  • 作者:非子萧
  • 时间:201708
    */
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.UI;
    using DG.Tweening;

public class SchoolMenuPanel : MonoBehaviour
{
public static SchoolMenuPanel _instance;//单例

private Button cefiroButton;//校园风采按钮
private Button studysectionButton;//学习园地按钮
private Button entertainmentButton;//休闲娱乐按钮
private Button testmodeButton;//考场模式按钮

private Image cefiroImage;//校园风采图标
private Image studysectionImage;//学习园地图标
private Image entertainmentImage;//休闲娱乐图标
private Image testmodeImage;//考场模式图标



private Tween cefiroButtonTweenPosition;
private Tween studysectionButtonTweenPosition;
private Tween entertainmentButtonTweenPosition;
private Tween testmodeButtonTweenPosition;
private Tween cefiroButtonTweenScale;
private Tween studysectionButtonTweenScale;
private Tween entertainmentButtonTweenScale;
private Tween testmodeButtonTweenScale;
void Awake()
{
    _instance = this;

    cefiroButton = transform.Find("CefiroButton").GetComponent

region//按钮点击

/// 
/// 校园风采按钮点击
/// 
public void OnCefiroButtonClick()
{
    cefiroButton.transform.DOScale(1.5f,0.5f);//1.2倍大,0.5s时间
}
/// 
/// 学习园地按钮点击
/// 
public void OnStudysectionButtonClick()
{
    studysectionButton.transform.DOScale(1.5f, 0.5f);
}
/// 
/// 休闲娱乐按钮点击
/// 
public void OnEntertainmentButtonClick()
{
    entertainmentButton.transform.DOScale(1.5f, 0.5f);
}
/// 
/// 考场模式
/// 
public void OnTestmodeButtonClick()
{
    testmodeButton.transform.DOScale(1.5f, 0.5f);
}
#endregion
#region//图标晃动
/// 
/// 校园风采图标晃动
/// 
public void OncefiroImageShakePosition()
{
    cefiroImage.transform.DOShakeScale(0.6f, 0.5f);
}
/// 
/// 学习园地图标晃动
/// 
public void OnstudysectionImageShakePosition()
{
    studysectionImage.transform.DOShakeScale(0.5f, 0.5f);
}
/// 
///  休闲娱乐图标晃动
/// 
public void OnentertainmentImageShakePosition()
{
    entertainmentImage.transform.DOShakeRotation(0.4f, 50);
}
/// 
/// 考场模式图标晃动
/// 
public void OntestmodeImageShakePosition()
{
    testmodeImage.transform.DOShakeRotation(0.3f, 60);
}
#endregion

}

你可能感兴趣的:(DoTween)