Exemplo n.º 1
0
        protected override Size OnGetPreferredSize(SizeConstraint w, SizeConstraint h)
        {
            if (Widget != null)
            {
                var req = Widget.Surface.GetPreferredSize();
                widget_alloc.Width  = req.Width;
                widget_alloc.Height = req.Height;
            }

            if (horizontal)
            {
                Width  = Choreographer.PixelCompose(percent, widget_alloc.Width + StartPadding + EndPadding, Easing);
                Height = widget_alloc.Height;
            }
            else
            {
                Width  = widget_alloc.Width;
                Height = Choreographer.PixelCompose(percent, widget_alloc.Height + StartPadding + EndPadding, Easing);
            }
            return(new Size(Width, Height));
        }
        protected virtual bool OnAnimationActorStep(Actor <BounceFadePopupWidget> actor)
        {
            if (actor.Expired)
            {
                OnAnimationCompleted();
                return(false);
            }

            // for the first half, use an easing
            if (actor.Percent < 0.5)
            {
                scale   = Choreographer.Compose(actor.Percent * 2, BounceEasing);
                opacity = 1.0;
            }
            //for the second half, vary opacity linearly from 1 to 0.
            else
            {
                scale   = Choreographer.Compose(1.0, BounceEasing);
                opacity = 1 - 2 * (actor.Percent - 0.5);
            }
            return(true);
        }
        bool OnAnimationActorStep(Actor <BounceFadePopupWindow> actor)
        {
            if (actor.Expired)
            {
                Destroy();
                return(false);
            }

            // for the first half, use an easing
            if (actor.Percent < 0.5)
            {
                scale   = Choreographer.Compose(actor.Percent * 2, BounceEasing);
                opacity = 1.0;
            }
            //for the second half, vary opacity linearly from 1 to 0.
            else
            {
                scale   = scale = Choreographer.Compose(1.0, BounceEasing);
                opacity = 2.0 - actor.Percent * 2;
            }
            return(true);
        }
Exemplo n.º 4
0
        protected override void OnSizeRequested(ref Requisition requisition)
        {
            if (Widget != null)
            {
                Requisition req = Widget.SizeRequest();
                widget_alloc.Width  = req.Width;
                widget_alloc.Height = req.Height;
            }

            if (horizontal)
            {
                Width  = Choreographer.PixelCompose(percent, widget_alloc.Width + StartPadding + EndPadding, Easing);
                Height = widget_alloc.Height;
            }
            else
            {
                Width  = widget_alloc.Width;
                Height = Choreographer.PixelCompose(percent, widget_alloc.Height + StartPadding + EndPadding, Easing);
            }

            requisition.Width  = Width;
            requisition.Height = Height;
        }
Exemplo n.º 5
0
 private void OnBorderIteration(object sender, EventArgs args)
 {
     if (border_stage.Actor == null)
     {
         if (border_state == AnimationState.Coming)
         {
             start_border = start_padding;
             end_border   = end_padding;
         }
         else
         {
             start_border = end_border = 0;
         }
         border_state = AnimationState.Idle;
     }
     else
     {
         double percent = border_state == AnimationState.Coming ? Percent : 1.0 - Percent;
         start_border = Choreographer.PixelCompose(percent, start_padding, border_easing);
         end_border   = Choreographer.PixelCompose(percent, end_padding, border_easing);
     }
     QueueResizeNoRedraw();
 }