public override void OnControlStateChanged(Button button, View.ControlStateChangedEventArgs args)
        {
            if (button.ControlState != ControlState.Pressed)
            {
                return;
            }

            var overlayImage = button.OverlayImage;

            if (overlayImage == null)
            {
                return;
            }

            if (null == PressAnimation)
            {
                var keyFrames = new KeyFrames();
                keyFrames.Add(0.0f, 0.0f);
                AlphaFunction linear = new AlphaFunction(AlphaFunction.BuiltinFunctions.Linear);
                keyFrames.Add(0.25f, 1.0f, linear);
                linear.Dispose();
                AlphaFunction ease = new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseOut);
                keyFrames.Add(1.0f, 0.0f, ease);
                ease.Dispose();

                PressAnimation           = new Animation(600);
                PressAnimation.EndAction = Animation.EndActions.StopFinal;
                PressAnimation.AnimateBetween(overlayImage, "Opacity", keyFrames);
                keyFrames.Dispose();
                Vector3       vec     = new Vector3(1, 1, 1);
                AlphaFunction easeout = new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseOut);
                PressAnimation.AnimateTo(overlayImage, "Scale", vec, 0, 600, easeout);
                vec.Dispose();
                easeout.Dispose();
            }

            if (PressAnimation.State == Animation.States.Playing)
            {
                PressAnimation.Stop();
                overlayImage.Hide();
            }

            overlayImage.Opacity      = 0.0f;
            overlayImage.CornerRadius = button.CornerRadius;
            overlayImage.Background   = button.Background;
            overlayImage.Size         = button.Size;
            overlayImage.Scale        = new Vector3(0.80f, 0.80f, 1);
            overlayImage.Show();

            PressAnimation.Play();
        }
Exemple #2
0
 public override void OnControlStateChanged(Button button, View.ControlStateChangedEventArgs args)
 {
     LottieButtonExtension.UpdateLottieView(button, args.PreviousState, LottieView);
 }
 public override void OnControlStateChanged(Button button, View.ControlStateChangedEventArgs args)
 {
     base.OnControlStateChanged(button, args);
 }
 public virtual void OnControlStateChanged(Button button, View.ControlStateChangedEventArgs args)
 {
 }