void EaseStart() { if (ease != null) { ease.End(); } ease = this.Ease(input.IsMouseDown ? 0.05f : 0.25f); }
void KillEase() { if (IsAnimating) { ease.Remove(); } ease = null; }
public void Hide() { if (!this.SetIfNotEqual(ref _visible, false)) { return; } yStart = yPosVisible; yEnd = yPosHidden; KillEase( ); ease = this.Ease(0.4f); ease.OnEnd += OnHide; }
public void Show( ) { if (!this.SetIfNotEqual(ref _visible, true)) { return; } var c = overlay.color; c.a = 0; overlay.color = c; yStart = yPosHidden; yEnd = yPosVisible; KillEase( ); ease = this.Ease(0.4f); ease.OnEnd += OnShow; PostionAtStart( ); gameObject.SetActive(true); }
void Update( ) { if (ease == null) { return; } //if(!( ease?.IsPlaying ?? false )) return; bool isDown = input.IsMouseDown; img.color = Color.Lerp( isDown ? colorUp : colorDown, isDown ? colorDown : colorUp, // half way to down (isDown ? 0.5f : 1) * ease.value ); if (!ease.IsPlaying) { ease.End( ); ease = null; } }
public static PUIEase Ease(this MonoBehaviour mono, float duration = 1f, PUIEase.EaseType ease = PUIEase.EaseType.InQuad) => PUIEase.Ease(mono.gameObject, duration, ease);
public static PUIEase Ease(this Transform train, float duration = 1f, PUIEase.EaseType ease = PUIEase.EaseType.InQuad) => PUIEase.Ease(train.gameObject, duration, ease);
public static PUIEase Ease(this GameObject go, float duration = 1f, PUIEase.EaseType ease = PUIEase.EaseType.InQuad) => PUIEase.Ease(go, duration, ease);