Example #1
0
 private void DragEventHandler(object sender, DragEventArgs e)
 {
     if (this.animationState != LiveSphere.AnimationState.Drag)
     {
         this.animationState = LiveSphere.AnimationState.Drag;
         return;
     }
     this.yAxis += -e.Distance.X * 3.14159274f / 180f;
     if (this.toggleEnabled)
     {
         if (this.yAxis < 0f)
         {
             this.yAxis = 0f;
         }
         else if (this.yAxis > 3.14159274f)
         {
             this.yAxis = 3.14159274f;
         }
     }
     this.UpdateRotateMatrix();
 }
Example #2
0
 public void Stop(bool withAnimate)
 {
     if (withAnimate)
     {
         this.isStopAnimate = true;
         return;
     }
     if (this.animation)
     {
         if ((int)Math.Round((double)(this.yAxis / 3.14159274f)) % 2 == 0)
         {
             this.yAxis = 0f;
         }
         else
         {
             this.yAxis = 3.14159274f;
         }
         this.animation      = false;
         this.animationState = LiveSphere.AnimationState.None;
         this.UpdateRotateMatrix();
     }
 }
Example #3
0
 private void Start(int revo, bool isFlick)
 {
     if (revo == 0)
     {
         return;
     }
     this.startAngle = this.yAxis;
     this.endAngle   = this.startAngle + (float)revo * 3.14159274f;
     this.endAngle   = (float)Math.Round((double)(this.endAngle / 3.14159274f)) * 3.14159274f;
     if (this.toggleEnabled)
     {
         this.acceleration *= 3f;
     }
     if (revo > 0)
     {
         this.flipEndAngle = this.endAngle - 1.57079637f;
         this.acceleration = -5E-06f;
         this.secondOmega  = 10.88f / this.bounceTime;
         this.firstOmega   = (float)Math.Sqrt((double)(this.secondOmega * this.secondOmega + 2f * this.acceleration * (this.startAngle - this.flipEndAngle)));
     }
     else
     {
         this.flipEndAngle = this.endAngle + 1.57079637f;
         this.acceleration = 5E-06f;
         this.secondOmega  = -10.88f / this.bounceTime;
         this.firstOmega   = -(float)Math.Sqrt((double)(this.secondOmega * this.secondOmega + 2f * this.acceleration * (this.startAngle - this.flipEndAngle)));
     }
     this.totalTime     = 0f;
     this.flipTime      = (this.secondOmega - this.firstOmega) / this.acceleration;
     this.isStopAnimate = false;
     this.animation     = true;
     if (isFlick)
     {
         this.animationState = LiveSphere.AnimationState.FlickFlip;
         return;
     }
     this.animationState = LiveSphere.AnimationState.Flip;
 }
Example #4
0
        protected internal override void OnTouchEvent(TouchEventCollection touchEvents)
        {
            base.OnTouchEvent(touchEvents);
            TouchEvent primaryTouchEvent = touchEvents.PrimaryTouchEvent;

            if (primaryTouchEvent.Type == TouchEventType.Down)
            {
                this.animation = false;
                Matrix4 transform3D = this.spherePrim.Transform3D;
                transform3D.M43             = this.radius * 0.2f;
                this.spherePrim.Transform3D = transform3D;
                return;
            }
            if (primaryTouchEvent.Type == TouchEventType.Enter)
            {
                Matrix4 transform3D2 = this.spherePrim.Transform3D;
                transform3D2.M43            = this.radius * 0.2f;
                this.spherePrim.Transform3D = transform3D2;
                return;
            }
            if (primaryTouchEvent.Type == TouchEventType.Leave)
            {
                Matrix4 transform3D3 = this.spherePrim.Transform3D;
                transform3D3.M43            = 0f;
                this.spherePrim.Transform3D = transform3D3;
                return;
            }
            if (primaryTouchEvent.Type == TouchEventType.Up)
            {
                Matrix4 transform3D4 = this.spherePrim.Transform3D;
                transform3D4.M43            = 0f;
                this.spherePrim.Transform3D = transform3D4;
                if (this.animationState == LiveSphere.AnimationState.None && !this.animation)
                {
                    if (this.ButtonAction != null)
                    {
                        this.ButtonAction.Invoke(this, new TouchEventArgs(touchEvents));
                        return;
                    }
                }
                else
                {
                    if (this.animationState == LiveSphere.AnimationState.Drag)
                    {
                        this.totalTime     = 0f;
                        this.endAngle      = (float)Math.Round((double)(this.yAxis / 3.14159274f)) * 3.14159274f;
                        this.flipEndAngle  = this.yAxis;
                        this.isStopAnimate = true;
                        this.animation     = true;
                        return;
                    }
                    if (this.animationState == LiveSphere.AnimationState.Flip)
                    {
                        this.animation = true;
                        this.Stop(true);
                        return;
                    }
                    if (this.animationState == LiveSphere.AnimationState.FlickFlip)
                    {
                        this.animationState = LiveSphere.AnimationState.Flip;
                    }
                }
            }
        }