Пример #1
0
 private void DragEventHandler(object sender, DragEventArgs e)
 {
     if (this.animationState != LiveFlipPanel.AnimationState.Drag)
     {
         if (this.animationState != LiveFlipPanel.AnimationState.Flip)
         {
             base.ResetState(false);
             if (this.isUseSprite)
             {
                 this.setupSprite();
             }
         }
         this.animationState = LiveFlipPanel.AnimationState.Drag;
         return;
     }
     this.angle += -e.Distance.X * 3.14159274f / 180f;
     this.UpdateRotateMatrix();
 }
Пример #2
0
        protected internal override void OnTouchEvent(TouchEventCollection touchEvents)
        {
            base.OnTouchEvent(touchEvents);
            TouchEvent primaryTouchEvent = touchEvents.PrimaryTouchEvent;

            if (primaryTouchEvent.Type == TouchEventType.Down)
            {
                this.animation = false;
            }
            else if (primaryTouchEvent.Type == TouchEventType.Up)
            {
                if (this.animationState == LiveFlipPanel.AnimationState.Drag)
                {
                    this.totalTime    = 0f;
                    this.endAngle     = (float)Math.Round((double)(this.angle / 3.14159274f)) * 3.14159274f;
                    this.flipEndAngle = this.angle;
                    if (this.isUseSprite)
                    {
                        this.setupSprite();
                    }
                    this.isStopAnimate = true;
                    this.animation     = true;
                }
                else if (this.animationState == LiveFlipPanel.AnimationState.Flip)
                {
                    this.animation = true;
                    this.Stop(true);
                }
                else if (this.animationState == LiveFlipPanel.AnimationState.FlickFlip)
                {
                    this.animationState = LiveFlipPanel.AnimationState.Flip;
                }
            }
            if (this.animationState != LiveFlipPanel.AnimationState.None)
            {
                touchEvents.Forward = true;
            }
        }
Пример #3
0
 private void Start(int revo, bool isFlick)
 {
     if (revo == 0)
     {
         return;
     }
     this.startAngle = this.angle;
     this.endAngle   = this.startAngle + (float)revo * 3.14159274f;
     this.endAngle   = (float)Math.Round((double)(this.endAngle / 3.14159274f)) * 3.14159274f;
     if (revo > 0)
     {
         this.flipEndAngle = this.endAngle - 1.57079637f;
         this.acceleration = -1f * Math.Abs(this.acceleration);
         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 = Math.Abs(this.acceleration);
         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;
     if (this.isUseSprite)
     {
         this.setupSprite();
     }
     this.animation = true;
     if (isFlick)
     {
         this.animationState = LiveFlipPanel.AnimationState.FlickFlip;
         return;
     }
     this.animationState = LiveFlipPanel.AnimationState.Flip;
 }
Пример #4
0
 public void Stop(bool withAnimate)
 {
     if (withAnimate)
     {
         this.isStopAnimate = true;
         return;
     }
     if (this.animation)
     {
         this.UpdateRotateMatrix();
         if (this.frontPanel.Visible)
         {
             this.angle = 0f;
         }
         else
         {
             this.angle = 3.14159274f;
         }
         this.frontSprt.Visible = false;
         this.backSprt.Visible  = false;
         this.animation         = false;
         this.animationState    = LiveFlipPanel.AnimationState.None;
     }
 }