<Path HeightRequest="65" WidthRequest="65" x:Name="Icon1" Fill="Transparent" Aspect="Uniform" Data="M 9.77234 30.8573 V 11.7471 H 7.54573 C 5.50932 11.7471 3.85742 13.3931 3.85742 15.425 V 27.1794 C 3.85742 29.2112 5.50932 30.8573 7.54573 30.8573 H 9.77234 Z M 11.9902 30.8573 V 11.7054 C 14.9897 10.627 16.6942 7.8853 17.1055 3.33591 C 17.2666 1.55463 18.9633 0.814421 20.5803 1.59505 C 22.1847 2.36964 23.243 4.32583 23.243 6.93947 C 23.243 8.50265 23.0478 10.1054 22.6582 11.7471 H 29.7324 C 31.7739 11.7471 33.4289 13.402 33.4289 15.4435 C 33.4289 15.7416 33.3928 16.0386 33.3215 16.328 L 30.9883 25.7957 C 30.2558 28.7683 27.5894 30.8573 24.528 30.8573 H 11.9911 H 11.9902 Z" VerticalOptions="Center" HorizontalOptions="Center" />
Content.AbortAnimation("ReshapeAnimations"); var offsetAnimationGroup = new Animation();
foreach (var item in this.PitContentLayout.Children) { if (item is Bubble) { var isOntop = this.PitContentLayout.Children.IndexOf(item) > this.PitContentLayout.Children.Count / 2; var currentAnimation = InitAnimation(item as Bubble, targetSize, isOntop); offsetAnimationGroup.Add(0, 1, currentAnimation);
public partial class TouchRecognizer: IDisposable { public event EventHandler<TouchActionEventArgs> OnTouchActionInvoked; public partial void Dispose(); }
private void StartCelebrationAnimate(Path progressElement, Action<double, bool> finished = null) { var toColor = (Color)this.Resources["BrandColor"]; var fromColor = (Color)this.Resources["DisabledColor"];
var scaleAnimation = new Animation();
var scaleUpAnimation0 = new Animation(v => progressElement.Scale=v, 0, 1.5); var scaleUpAnimation1 = new Animation(v => progressElement.Fill=GetColor(v, fromColor, toColor), 0, 1); var scaleUpAnimation2 = new Animation(v => progressElement.Scale=v, 1.5, 1);
private void TouchContentView_OnTouchActionInvoked(object sender, TouchActionEventArgs e) { var layout = ((Microsoft.Maui.Controls.Layout)(sender as TouchContentView).Content).Children; var bubbles = layout[0] as Bubbles; var circleProgressBar = layout[1] as CircleProgressBar;
switch (e.Type) { case TouchActionType.Entered: break; case TouchActionType.Pressed: _dispatcherTimer =Dispatcher.CreateTimer(); _dispatcherTimer.Interval=new TimeSpan(0, 0, 1);
_dispatcherTimer.Tick+= async (o, e) => { _isInProgress=true; this.UpdateProgressWithAnimate(ProgressBar1, 100, 2*1000, (d, b) => { if (circleProgressBar.Progress==100) { this.bubbles1.StartAnimation(); StartCelebrationAnimate(this.Icon1); } }); this.UpdateProgressWithAnimate(ProgressBar2, 100, 2*1000, (d, b) => { if (circleProgressBar.Progress==100) { this.bubbles2.StartAnimation(); StartCelebrationAnimate(this.Icon2); } }); this.UpdateProgressWithAnimate(ProgressBar3, 100, 2*1000, (d, b) => { if (circleProgressBar.Progress==100) { this.bubbles3.StartAnimation(); StartCelebrationAnimate(this.Icon3); } });
};
_dispatcherTimer.Start();
break; case TouchActionType.Moved: break; case TouchActionType.Released:
if (!_isInProgress) { var brandColor = (Color)this.Resources["BrandColor"]; var disabledColor = (Color)this.Resources["DisabledColor"];
if (circleProgressBar.Progress==100) { this.UpdateProgressWithAnimate(ProgressBar1, 0, 1000); this.UpdateProgressWithAnimate(ProgressBar2, 0, 1000); this.UpdateProgressWithAnimate(ProgressBar3, 0, 1000); (ProgressBar1.LabelContent as Path).Fill=disabledColor; (ProgressBar2.LabelContent as Path).Fill=disabledColor; (ProgressBar3.LabelContent as Path).Fill=disabledColor;
} else { if (((circleProgressBar.LabelContent as Path).Fill as SolidColorBrush).Color==disabledColor) { StartCelebrationAnimate(circleProgressBar.LabelContent as Path);
} else { (circleProgressBar.LabelContent as Path).Fill=disabledColor; } }
} if (_dispatcherTimer!=null) { if (_dispatcherTimer.IsRunning) { _dispatcherTimer.Stop(); _isInProgress=false;