コード例 #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;
            }));
        }
コード例 #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));
        }
コード例 #3
0
        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));
        }
コード例 #4
0
ファイル: Animation.cs プロジェクト: sung-su/maui
 public void Resume()
 {
     paused = false;
     animationManger?.Add(this);
 }