├── .gitignore ├── ButtonAnim.cs ├── ButtonAnim.cs.meta ├── Editor.meta ├── Editor ├── ButtonAnimEditor.cs ├── ButtonAnimEditor.cs.meta ├── ButtonAnimTweenSettingDrawer.cs ├── ButtonAnimTweenSettingDrawer.cs.meta ├── PropertyDrawerBase.cs ├── PropertyDrawerBase.cs.meta ├── SingleTweenDrawer.cs ├── SingleTweenDrawer.cs.meta ├── UIDOTweenEditor.cs └── UIDOTweenEditor.cs.meta ├── Example.meta ├── Example ├── Example.unity └── Example.unity.meta ├── FlashAnim.cs ├── FlashAnim.cs.meta ├── LICENSE ├── README.md ├── Screenshots.meta ├── Screenshots ├── Inspector.png └── Inspector.png.meta ├── SingleTween.cs ├── SingleTween.cs.meta ├── SliderAnim.cs ├── SliderAnim.cs.meta ├── UIDOTween.cs └── UIDOTween.cs.meta /.gitignore: -------------------------------------------------------------------------------- 1 | # This .gitignore file should be placed at the root of your Unity project directory 2 | # 3 | # Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore 4 | # 5 | /[Ll]ibrary/ 6 | /[Tt]emp/ 7 | /[Oo]bj/ 8 | /[Bb]uild/ 9 | /[Bb]uilds/ 10 | /[Ll]ogs/ 11 | /[Mm]emoryCaptures/ 12 | 13 | # Asset meta data should only be ignored when the corresponding asset is also ignored 14 | !/[Aa]ssets/**/*.meta 15 | 16 | # Uncomment this line if you wish to ignore the asset store tools plugin 17 | # /[Aa]ssets/AssetStoreTools* 18 | 19 | # Autogenerated Jetbrains Rider plugin 20 | [Aa]ssets/Plugins/Editor/JetBrains* 21 | 22 | # Visual Studio cache directory 23 | .vs/ 24 | 25 | # Gradle cache directory 26 | .gradle/ 27 | 28 | # Autogenerated VS/MD/Consulo solution and project files 29 | ExportedObj/ 30 | .consulo/ 31 | *.csproj 32 | *.unityproj 33 | *.sln 34 | *.suo 35 | *.tmp 36 | *.user 37 | *.userprefs 38 | *.pidb 39 | *.booproj 40 | *.svd 41 | *.pdb 42 | *.mdb 43 | *.opendb 44 | *.VC.db 45 | 46 | # Unity3D generated meta files 47 | *.pidb.meta 48 | *.pdb.meta 49 | *.mdb.meta 50 | 51 | README.md.meta 52 | LICENSE.meta 53 | 54 | # Unity3D generated file on crash reports 55 | sysinfo.txt 56 | 57 | # Builds 58 | *.apk 59 | *.unitypackage 60 | 61 | # Crashlytics generated file 62 | crashlytics-build.properties 63 | 64 | -------------------------------------------------------------------------------- /ButtonAnim.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using DG.Tweening; 3 | using UnityEngine; 4 | using UnityEngine.EventSystems; 5 | using UnityEngine.UI; 6 | 7 | namespace GameUtil 8 | { 9 | public class ButtonAnim : MonoBehaviour, IPointerDownHandler, IPointerUpHandler, IPointerEnterHandler, IPointerExitHandler 10 | { 11 | [Serializable] 12 | public class TweenSetting 13 | { 14 | public float Duration; 15 | public bool UseCurve; 16 | public AnimationCurve Curve; 17 | public Ease EaseType; 18 | public Vector3 Scale; 19 | 20 | public TweenSetting() { } 21 | 22 | public TweenSetting(float duration, bool useCurve, AnimationCurve curve, Ease easeType, Vector3 scale) 23 | { 24 | Duration = duration; 25 | UseCurve = useCurve; 26 | Curve = curve; 27 | EaseType = easeType; 28 | Scale = scale; 29 | } 30 | } 31 | 32 | [SerializeField] private Transform m_ScaleTransform; 33 | [SerializeField] private Button m_Button; 34 | public bool RelativeScale = true; 35 | public TweenSetting DownSetting = new TweenSetting(0.1f, false, AnimationCurve.Linear(0,0,1,1), Ease.OutQuad, new Vector3(0.95f, 0.95f, 1)); 36 | public TweenSetting UpSetting = new TweenSetting(0.1f, false, AnimationCurve.Linear(0,0,1,1), Ease.OutQuad, new Vector3(1.02f, 1.02f, 1)); 37 | public bool NeedSecondUpSetting = true; 38 | public TweenSetting SecondUpSetting = new TweenSetting(0.08f, false, AnimationCurve.Linear(0,0,1,1), Ease.OutQuad, new Vector3(1, 1, 1)); 39 | 40 | private Vector3 mStartScale; 41 | private Tween mTween; 42 | private bool mIsPress; 43 | private bool mIsStay; 44 | private bool mIsEnable = true; 45 | 46 | private bool mInteractable => !m_Button || m_Button.gameObject.activeSelf && m_Button.enabled && m_Button.interactable; 47 | 48 | private void Awake() 49 | { 50 | if (!m_Button) 51 | m_Button = gameObject.GetComponent