public void StopBars() { try { Animating = false; if (PlayingSet != null && PlayingSet.IsRunning && PlayingSet.IsStarted) { if (Build.VERSION.SdkInt < (BuildVersionCodes)19) { PlayingSet.End(); } else { PlayingSet.Pause(); } } if (StopSet == null) { // Animate stopping bars ObjectAnimator scaleY1 = ObjectAnimator.OfFloat(MusicBar1, "scaleY", 0.1f); ObjectAnimator scaleY2 = ObjectAnimator.OfFloat(MusicBar2, "scaleY", 0.1f); ObjectAnimator scaleY3 = ObjectAnimator.OfFloat(MusicBar3, "scaleY", 0.1f); StopSet = new AnimatorSet(); StopSet.PlayTogether(scaleY3, scaleY2, scaleY1); StopSet.SetDuration(200); StopSet.Start(); } else if (!StopSet.IsStarted) { StopSet.Start(); } } catch (Exception e) { Console.WriteLine(e); } }
public void Pause() { waterAnimator?.Pause(); wavesAnimator?.Pause(); }