public void SetupInitialAnimations(Action callback = null) { int delay = 10; var time = Resources.GetInteger(Android.Resource.Integer.ConfigMediumAnimTime); var delayIncr = (3 * time) / 4; var interpolator = new Android.Views.Animations.DecelerateInterpolator(); ViewPropertyAnimator circleAnim = null; foreach (var id in circleIds) { var circle = circlesLayout.FindViewById(id); circle.ScaleX = .3f; circle.ScaleY = .3f; circle.Alpha = 0; circleAnim = circle.Animate() .ScaleX(1) .ScaleY(1) .Alpha(1) .SetStartDelay(delay) .SetDuration(time) .SetInterpolator(interpolator); var last = id == circleIds.Last(); if (last && callback != null) { circleAnim.WithEndAction(new Run(callback)); } circleAnim.Start(); delay += delayIncr; } }
protected static void Hide(View view) { ViewPropertyAnimator animator = view.Animate().TranslationY(viewY).SetInterpolator(INTERPOLATOR).SetDuration(300); animator.SetListener(new HideAnimatorListener(view)); animator.Start(); }
private void OnTimedEvent(object sender, System.Timers.ElapsedEventArgs e) { var width = _currentImageView.Width; RunOnUiThread(() => { _nextImageView.TranslationX = width; _currentImageView.Animate().SetDuration(300).TranslationX(-width).Start(); _animator = _nextImageView.Animate().SetDuration(300).TranslationX(0).SetListener(_listener); _animator.Start(); }); }
private static Task RunAnimationAsync( ViewPropertyAnimator animator) { if (null == animator) { throw new ArgumentNullException(nameof(animator)); } AsyncAnimatorListener listener = new AsyncAnimatorListener(); animator.SetListener(listener); animator.Start(); return(listener.Task); }
private void RunCountdown(int countdownTime, Action onFinished) { UpdateCountdownLabel(countdownTime); ViewPropertyAnimator animator = _label.Animate().ScaleX(0).ScaleY(0).Alpha(0.0f).SetDuration(1000); if (countdownTime > 0) { animator.WithEndAction(new Runnable(() => RunCountdown(countdownTime - 1, onFinished))); } else { animator.WithStartAction(new Runnable(onFinished)); animator.WithEndAction(new Runnable(() => _label.Visibility = ViewStates.Visible)); } animator.Start(); }
private void Overshoot() { try { if (_animatedView != null) { var interpolator = new OvershootInterpolator(); _animator.TranslationY(DeltaXY.YDelta); _animator.SetDuration(GetResourceAnimationTimeValue()); //duration _animator.SetInterpolator(interpolator); _animator.Start(); } } catch (Exception e) { Log.Error(TAG, "Overshoot: Exception - " + e.Message); } }