public void MoveAnchors(Vector2 anchorMin, Vector2 anchorMax, UIAnimationDirection animationDirection = UIAnimationDirection.From, Action callback = null, UIAnimationOptions animationOptions = null) { var anchors = new Vector4(anchorMin.x, anchorMin.y, anchorMax.x, anchorMax.y); AnchorsTweener.Tween(anchors, animationDirection, callback, animationOptions); }
public void Animate(UIAnimator animator, Action callback = null, UIAnimationOptions animationOptions = null) { if (animationOptions == null) { animationOptions = new UIAnimationOptions(savePosition, Duration == 0, _customEasingFunction, Duration, Delay); } if (animatePosition) { animator.Move(positionDelta, positionAnimationDirection, callback, animationOptions); callback = null; } if (animateAnchors) { animator.MoveAnchors(minAnchorDelta, maxAnchorDelta, anchorsAnimationDirection, callback, animationOptions); callback = null; } if (animateRotation) { animator.Rotate(rotationDelta, rotationAnimationDirection, callback, animationOptions); callback = null; } if (animateSize) { animator.Resize(sizeDelta, sizeAnimationDirection, callback, animationOptions); callback = null; } if (animateScale) { animator.Scale(scaleDelta, scaleAnimationDirection, callback, animationOptions); callback = null; } if (animateAlpha) { animator.Fade(alphaDelta, alphaAnimationDirection, callback, animationOptions); callback = null; } callback?.Invoke(); }
public void Fade(float fade, UIAnimationDirection animationDirection = UIAnimationDirection.To, Action callback = null, UIAnimationOptions animationOptions = null) { AlphaTweener.Tween(fade, animationDirection, callback, animationOptions); }
public void Scale(Vector3 scale, UIAnimationDirection animationDirection = UIAnimationDirection.From, Action callback = null, UIAnimationOptions animationOptions = null) { ScaleTweener.Tween(scale, animationDirection, callback, animationOptions); }
public void Resize(Vector2 size, UIAnimationDirection animationDirection = UIAnimationDirection.RelativeTo, Action callback = null, UIAnimationOptions animationOptions = null) { SizeTweener.Tween(size, animationDirection, callback, animationOptions); }
public void Rotate(Vector3 rotation, UIAnimationDirection animationDirection = UIAnimationDirection.From, Action callback = null, UIAnimationOptions animationOptions = null) { RotationTweener.Tween(rotation, animationDirection, callback, animationOptions); }
public void Move(Vector3 position, UIAnimationDirection animationDirection = UIAnimationDirection.To, Action callback = null, UIAnimationOptions animationOptions = null) { PositionTweener.Tween(position, animationDirection, callback, animationOptions); }
// ReSharper disable once MethodOverloadWithOptionalParameter public void Play(UIAnimation uiAnimation, bool resetToSavedProperties = false, Action callback = null, UIAnimationOptions animationOptions = null) { if (uiAnimation == null) { callback?.Invoke(); return; } // TODO concurrent animations; hover & click at the same time // track all animations; some animations stop other animations (e.g. close stops open) if (_currentAnimation != null) { if (uiAnimation == GetAnimation(UIAnimationType.OnOpen) || uiAnimation == GetAnimation(UIAnimationType.OnClose)) { _currentAnimation.Stop(this); } else { return; } } if (resetToSavedProperties) { ResetToSavedProperties(); } OnAnimationStart(uiAnimation); Action animationCallback; if (callback == null) { animationCallback = () => { OnAnimationEnd(uiAnimation); }; } else { animationCallback = () => { OnAnimationEnd(uiAnimation); callback(); }; } uiAnimation.Animate(this, animationCallback, animationOptions); }