private async void CommitShakeAnimation() { uint timeout = 50; await Task.WhenAll(new List <Task> { BGSymbolImage.TranslateTo(-15, 0, timeout), HeroImage1.TranslateTo(-15, 0, timeout), LabelDate.TranslateTo(-15, 0, timeout), LabelTime.TranslateTo(-15, 0, timeout), HeroImage3.TranslateTo(-15, 0, timeout) }); await Task.WhenAll(new List <Task> { BGSymbolImage.TranslateTo(15, 0, timeout), HeroImage1.TranslateTo(15, 0, timeout), LabelDate.TranslateTo(15, 0, timeout), LabelTime.TranslateTo(15, 0, timeout), HeroImage3.TranslateTo(15, 0, timeout) }); await Task.WhenAll(new List <Task> { BGSymbolImage.TranslateTo(-9, 0, timeout), HeroImage1.TranslateTo(-9, 0, timeout), LabelDate.TranslateTo(-9, 0, timeout), LabelTime.TranslateTo(-9, 0, timeout), HeroImage3.TranslateTo(-9, 0, timeout) }); await Task.WhenAll(new List <Task> { BGSymbolImage.TranslateTo(9, 0, timeout), HeroImage1.TranslateTo(9, 0, timeout), LabelDate.TranslateTo(9, 0, timeout), LabelTime.TranslateTo(9, 0, timeout), HeroImage3.TranslateTo(9, 0, timeout) }); await Task.WhenAll(new List <Task> { BGSymbolImage.TranslateTo(-5, 0, timeout), HeroImage1.TranslateTo(-5, 0, timeout), LabelDate.TranslateTo(-5, 0, timeout), LabelTime.TranslateTo(-5, 0, timeout), HeroImage3.TranslateTo(-5, 0, timeout) }); await Task.WhenAll(new List <Task> { BGSymbolImage.TranslateTo(5, 0, timeout), HeroImage1.TranslateTo(5, 0, timeout), LabelDate.TranslateTo(5, 0, timeout), LabelTime.TranslateTo(5, 0, timeout), HeroImage3.TranslateTo(5, 0, timeout) }); await Task.WhenAll(new List <Task> { BGSymbolImage.TranslateTo(-2, 0, timeout), HeroImage1.TranslateTo(-2, 0, timeout), LabelDate.TranslateTo(-2, 0, timeout), LabelTime.TranslateTo(-2, 0, timeout), HeroImage3.TranslateTo(-2, 0, timeout) }); await Task.WhenAll(new List <Task> { BGSymbolImage.TranslateTo(2, 0, timeout), HeroImage1.TranslateTo(2, 0, timeout), LabelDate.TranslateTo(2, 0, timeout), LabelTime.TranslateTo(2, 0, timeout), HeroImage3.TranslateTo(2, 0, timeout) }); BGSymbolImage.TranslationX = 0; LabelDate.TranslationX = 0; LabelTime.TranslationX = 0; HeroImage1.TranslationX = 0; HeroImage3.TranslationX = 0; }
private async void OnHero1Clicked(object sender, EventArgs args) { if (_isHero1AnimaitionRunning) { return; } _isHero1AnimaitionRunning = true; MakeAndCommitSymbolAnimation(); string hero1 = ((WatchViewModel)BindingContext).Hero1ImageSource; var x = HeroImage1.Bounds.X; await Task.WhenAll(new List <Task> { HeroImage1.LayoutTo(new Rectangle(-200, HeroImage1.Bounds.Y, HeroImage1.Bounds.Width, HeroImage1.Bounds.Height), 500, Easing.SinIn) }); ((WatchViewModel)BindingContext).Hero1ImageSource = hero1.Equals(WatchViewModel.s_defaultHero1ImageSource) ? WatchViewModel.s_altHero1ImageSource : WatchViewModel.s_defaultHero1ImageSource; await Task.WhenAll(new List <Task> { HeroImage1.LayoutTo(new Rectangle(x, HeroImage1.Bounds.Y, HeroImage1.Bounds.Width, HeroImage1.Bounds.Height), 500, Easing.SinOut) }); _isHero1AnimaitionRunning = false; }