private async void OnHero3Clicked(object sender, EventArgs args) { if (_isHero3AnimaitionRunning) { return; } _isHero3AnimaitionRunning = true; await BGColorChangeTask(Color.Black, Color.White); await BGColorChangeTask(Color.White, Color.Black); await BGColorChangeTask(Color.Black, Color.White); await BGColorChangeTask(Color.White, Color.Black); string hero3 = ((WatchViewModel)BindingContext).Hero3ImageSource; if (hero3.Equals(WatchViewModel.s_defaultHero3ImageSource)) { await Task.WhenAll(new List <Task> { Hero3Eyes.ScaleTo(3, 250, Easing.SpringIn), BGColorChangeTask(Color.Black, Color.White) }); await Task.WhenAll(new List <Task> { Hero3Eyes.ScaleTo(1, 250, Easing.SpringOut), BGColorChangeTask(Color.White, Color.Black) }); await Task.WhenAll(new List <Task> { HeroImage3.FadeTo(0, 100, Easing.CubicOut), Hero3Eyes.FadeTo(0, 100, Easing.CubicOut), BGColorChangeTask(Color.Black, Color.White) }); ((WatchViewModel)BindingContext).Hero3ImageSource = WatchViewModel.s_altHero3ImageSource; await Task.WhenAll(new List <Task> { HeroImage3.FadeTo(1, 100, Easing.CubicIn), BGColorChangeTask(Color.White, Color.Black) }); } else { await Task.WhenAll(new List <Task> { HeroImage3.FadeTo(0, 100, Easing.CubicOut), Hero3Eyes.FadeTo(0, 100, Easing.CubicOut), BGColorChangeTask(Color.Black, Color.White) }); ((WatchViewModel)BindingContext).Hero3ImageSource = WatchViewModel.s_defaultHero3ImageSource; await Task.WhenAll(new List <Task> { HeroImage3.FadeTo(1, 100, Easing.CubicIn), Hero3Eyes.FadeTo(1, 100, Easing.CubicIn), BGColorChangeTask(Color.White, Color.Black) }); } await BGColorChangeTask(Color.Black, Color.White); await BGColorChangeTask(Color.White, Color.Black); BGSymbolImage.BackgroundColor = Color.Transparent; _isHero3AnimaitionRunning = false; }
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; }