예제 #1
0
 public UIPositionAnimation(RectTransform transform, UIPositionAnimation animation) :
     this(transform, animation.originPosition, animation.targetPosition, animation.duration)
 {
     originPosition  = animation.originPosition;
     targetPosition  = animation.targetPosition;
     updateBehaviour = animation.updateBehaviour;
     effectBehaviour = animation.effectBehaviour;
 }
예제 #2
0
 public UIScaleAnimation(RectTransform transform, Vector3 origin, Vector3 target, float duration)
 {
     this.transform   = transform;
     this.duration    = duration < 0.0000001f ? 0.0000001f : duration;
     this.originScale = origin;
     this.targetScale = target;
     updateBehaviour  = Modifier.Linear;
     effectBehaviour  = Effect.NoEffect;
 }
예제 #3
0
 public UIPositionAnimation(RectTransform transform, Vector2 origin, Vector2 target, float duration)
 {
     this.transform      = transform;
     this.duration       = duration < 0.0000001f ? 0.0000001f : duration;
     this.originPosition = Vector2.Scale(origin, UIAnimator.ScreenDimension) - (Vector2)transform.position + transform.anchoredPosition;
     this.targetPosition = Vector2.Scale(target, UIAnimator.ScreenDimension) - (Vector2)transform.position + transform.anchoredPosition;
     updateBehaviour     = Modifier.Linear;
     effectBehaviour     = Effect.NoEffect;
 }
예제 #4
0
 public UIRotationAnimation(RectTransform transform, float origin, float target, float duration)
 {
     this.transform   = transform;
     this.duration    = duration < 0.0000001f ? 0.0000001f : duration;
     this.originAngle = origin;
     this.targetAngle = target;
     updateBehaviour  = Modifier.Linear;
     effectBehaviour  = Effect.NoEffect;
     unclamped        = true;
 }
예제 #5
0
 public UIRotationAnimation(RectTransform transform, Quaternion origin, Quaternion target, float duration)
 {
     this.transform      = transform;
     this.duration       = duration < 0.0000001f ? 0.0000001f : duration;
     this.originRotation = origin;
     this.targetRotation = target;
     updateBehaviour     = Modifier.Linear;
     effectBehaviour     = Effect.NoEffect;
     unclamped           = false;
 }
예제 #6
0
        /*  Set Effect
         *      Sets effect
         *
         *      For more on Effects, please see Effects class
         */
        public override UIAnimation SetEffect(Effect.EffectUpdate effect, Quaternion rotation = default(Quaternion))
        {
            Vector2 direction = (targetPosition - originPosition).normalized;

            direction = (direction == Vector2.zero) ? Vector2.right : direction;
            Vector2 directionVector = rotation * direction;

            directionVector     *= UIAnimator.ScreenDimension.y;
            this.effectBehaviour = Effect.GetBehaviour(effect, directionVector);
            return(this);
        }
        public UIPositionAnimation(RectTransform transform, Vector2 origin, Vector2 target, float duration)
        {
            Canvas canvas      = UIAnimator.FindObjectOfType <Canvas>();
            float  canvasScale = (UIAnimator.ScaleWithScreen) ? 1 / canvas.scaleFactor : 1;

            this.transform = transform;
            this.duration  = duration < 0.0000001f ? 0.0000001f : duration;
            Vector2 position = (canvas.renderMode == RenderMode.ScreenSpaceCamera) ? canvas.worldCamera.WorldToScreenPoint(transform.position) : transform.position;

            this.originPosition = Vector2.Scale(origin, UIAnimator.ScreenDimension) * canvasScale - position * canvasScale + transform.anchoredPosition;
            this.targetPosition = Vector2.Scale(target, UIAnimator.ScreenDimension) * canvasScale - position * canvasScale + transform.anchoredPosition;
            updateBehaviour     = Modifier.Linear;
            effectBehaviour     = Effect.NoEffect;
            //DEBUG

            /*
             * Debug.Log("Screen Dimention: " + UIAnimator.ScreenDimension);
             * Debug.Log("Canvas Scale: " + canvasScale);
             * Debug.Log("Origin: " + this.originPosition + " (" + Vector2.Scale(origin, UIAnimator.ScreenDimension) + " - " + position + " + " + transform.anchoredPosition + ")");
             * Debug.Log("Target: " + this.targetPosition + " (" + Vector2.Scale(target, UIAnimator.ScreenDimension) + " - " + position + " + " + transform.anchoredPosition + ")");
             */
        }
예제 #8
0
 public override UIAnimation SetEffect(Effect.EffectUpdate effect, Quaternion rotation = default(Quaternion))
 {
     this.effectBehaviour = Effect.GetBehaviour(effect, Vector2.right);
     return(this);
 }
예제 #9
0
 /*  Set Effect
  *      Sets effect
  *
  *      For more on Effects, please see Effects class
  */
 public override UIAnimation SetEffect(Effect.EffectUpdate effect, Quaternion rotation = default(Quaternion))
 {
     this.effectBehaviour = Effect.GetBehaviour(effect, rotation * (targetScale - originScale));
     return(this);
 }