Exemplo n.º 1
0
        internal void AnimateRippleEffect()
        {
            if (!(Drawable is MaterialStepperDrawable))
            {
                return;
            }

            if (_animationManager == null)
            {
                _animationManager = MauiContext?.Services.GetRequiredService <IAnimationManager>();
            }

            float start = 0;
            float end   = 1;

            _animationManager?.Add(new Animation(callback: (progress) =>
            {
                Drawable.AnimationPercent = start.Lerp(end, progress);
                Invalidate();
            }, duration: 0.3, easing: Easing.SinInOut,
                                                 finished: () =>
            {
                Drawable.AnimationPercent = 0;
            }));
        }
Exemplo n.º 2
0
        internal void AnimatePlaceholder()
        {
            if (!(Drawable is MaterialEntryDrawable))
            {
                return;
            }

            bool hasText = !string.IsNullOrEmpty(VirtualView.Text);

            if (hasText)
            {
                return;
            }

            if (_animationManager == null)
            {
                _animationManager = MauiContext?.Services.GetRequiredService <IAnimationManager>();
            }

            float start = Drawable.HasFocus ? 0 : 1;
            float end   = Drawable.HasFocus ? 1 : 0;

            _animationManager?.Add(new Animation(callback: (progress) =>
            {
                Drawable.AnimationPercent = start.Lerp(end, progress);
                Invalidate();
            }, duration: 0.1, easing: Easing.Linear));
        }
        internal void AnimateToggle()
        {
            if (_animationManager == null)
            {
                _animationManager = MauiContext?.Services.GetRequiredService <IAnimationManager>();
            }

            float start = VirtualView.IsOn ? 0 : 1;
            float end   = VirtualView.IsOn ? 1 : 0;

            _animationManager?.Add(new Animation(callback: (progress) =>
            {
                Drawable.AnimationPercent = start.Lerp(end, progress);
                Invalidate();
            }, duration: 0.1, easing: Easing.Linear));
        }
Exemplo n.º 4
0
 public void Resume()
 {
     paused = false;
     animationManger?.Add(this);
 }