private void Animator() { var paddingTop = Resources.GetDimensionPixelSize(Resource.Dimension.scroll_padding_top); var scrollAnimator = ViewPropertyObjectAnimator .Animate(scrollView) .ScrollY(paddingTop) .Get(); var imageAnimator = ViewPropertyObjectAnimator .Animate(imageView) .VerticalMargin(140) .RightMarginBy(10) .Width(600) .Height(700) .RotationXBy(20) .TopPadding(10) .RotationY(360) .LeftPaddingBy(100) .RightPadding(300) .Get(); animatorSet?.Cancel(); animatorSet = new AnimatorSet(); animatorSet.PlayTogether(scrollAnimator, imageAnimator); animatorSet.SetDuration(2000); animatorSet.Start(); }
public override void Start(GoogleMap googleMap, IList <PositionModel> route) { _googleMap = googleMap; if (_firstRunAnimSet == null) { _firstRunAnimSet = new AnimatorSet(); } else { _firstRunAnimSet.RemoveAllListeners(); _firstRunAnimSet.End(); _firstRunAnimSet.Cancel(); _firstRunAnimSet = new AnimatorSet(); } LatLng[] bangaloreRoute = route.Select(e => new LatLng(e.Lat.GetValueOrDefault(0), e.Lng.GetValueOrDefault(0))).ToArray(); if (bangaloreRoute.Length == 0) { return; } var foregroundRouteAnimator = ObjectAnimator.OfObject(this, "routeIncreaseForward", new RouteEvaluator(), bangaloreRoute.ToArray <Object>()); foregroundRouteAnimator.SetInterpolator(new LinearInterpolator()); foregroundRouteAnimator.SetDuration((long)TimeSpan.FromMinutes(3).TotalMilliseconds); foregroundRouteAnimator.RepeatCount = ValueAnimator.Infinite; _firstRunAnimSet.PlaySequentially(foregroundRouteAnimator); _firstRunAnimSet.Start(); }
public void Reset() { waterAnimator.Cancel(); var resetDuration = 256; waterAnimatorReverse = AnimateWaterReverse(resources); waterAnimatorReverse.SetDuration(resetDuration); waterAnimatorReverse.Start(); waterAnimator.StartDelay = resetDuration; }
/// <summary> /// if the user started a new Record while the Animation is running /// then we want to stop the current animation and revert views back to default state /// </summary> public void ResetBasketAnimation() { try { if (IsBasketAnimating) { TranslateAnimation1?.Reset(); TranslateAnimation1?.Cancel(); TranslateAnimation2?.Reset(); TranslateAnimation2?.Cancel(); MicAnimation.Cancel(); SmallBlinkingMic.ClearAnimation(); BasketImg.ClearAnimation(); Handler1?.RemoveCallbacksAndMessages(null); Handler2?.RemoveCallbacksAndMessages(null); BasketImg.Visibility = ViewStates.Invisible; SmallBlinkingMic.SetX(MicX); SmallBlinkingMic.SetY(MicY); SmallBlinkingMic.Visibility = ViewStates.Gone; IsBasketAnimating = false; } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
/** * Toogle the play/pause status * * @param withAnim false to change status without animation */ public void Toggle(bool withAnim) { if (withAnim) { if (mAnimatorSet != null) { mAnimatorSet.Cancel(); } mAnimatorSet = new AnimatorSet(); bool isPlay = mDrawable.IsPlay(); ObjectAnimator colorAnim = ObjectAnimator.OfInt(this, "color", isPlay ? mPauseBackgroundColor : mPlayBackgroundColor); colorAnim.SetEvaluator(new ArgbEvaluator()); Animator pausePlayAnim = mDrawable.GetPausePlayAnimator(); mAnimatorSet.SetInterpolator(new DecelerateInterpolator()); mAnimatorSet.SetDuration(PlayPauseAnimationDuration); mAnimatorSet.PlayTogether(colorAnim, pausePlayAnim); mAnimatorSet.Start(); } else { bool isPlay = mDrawable.IsPlay(); InitStatus(!isPlay); Invalidate(); } }
public void Cancel() { lock (_lockObject) { _animatorSet?.Cancel(); } }
public void SetGlow(float glow) { if (!glowAnimationSet.IsRunning || glow == 0f) { if (glowAnimationSet.IsRunning) { glowAnimationSet.Cancel(); } if (currViewTopGlow != null && currViewBottomGlow != null) { if (glow == 0f || currViewTopGlow.Alpha == 0f) { // animate glow in and out glowTopAnimation.SetTarget(currViewTopGlow); glowBottomAnimation.SetTarget(currViewBottomGlow); glowTopAnimation.SetFloatValues(glow); glowBottomAnimation.SetFloatValues(glow); glowAnimationSet.SetupStartValues(); glowAnimationSet.Start(); } else { // set it explicitly in reponse to touches. currViewTopGlow.Alpha = glow; currViewBottomGlow.Alpha = glow; HandleGlowVisibility(); } } } }
public void OnCenterPosition(bool animate) { if (animate) { shrinkAnimator.Cancel(); if (!expandAnimator.IsRunning) { expandCircleAnimator.SetFloatValues(colorView.CircleRadius, expandCircleRadius); expandLabelAnimator.SetFloatValues(label.Alpha, ExpandLabelAlpha); expandAnimator.Start(); } } else { expandAnimator.Cancel(); colorView.CircleRadius = expandCircleRadius; label.Alpha = ExpandLabelAlpha; } }
public void StopAllAnimations() { lock (_lockObject) { if (_animatorSet != null) { _animatorSet.Cancel(); _animatorSet.RemoveAllListeners(); } } }
void Switch(Drawable src, ColorStateList tint) { const int ScaleDuration = 200; const int AlphaDuration = 150; const int AlphaInDelay = 50; const int InitialDelay = 100; if (switchAnimation != null) { switchAnimation.Cancel(); switchAnimation = null; } var currentSrc = this.Drawable; // Scaling down animation var circleAnimOutX = ObjectAnimator.OfFloat(this, "scaleX", 1, 0.1f); var circleAnimOutY = ObjectAnimator.OfFloat(this, "scaleY", 1, 0.1f); circleAnimOutX.SetDuration(ScaleDuration); circleAnimOutY.SetDuration(ScaleDuration); // Alpha out of the icon var iconAnimOut = ObjectAnimator.OfInt(currentSrc, "alpha", 255, 0); iconAnimOut.SetDuration(AlphaDuration); var outSet = new AnimatorSet(); outSet.PlayTogether(circleAnimOutX, circleAnimOutY, iconAnimOut); outSet.SetInterpolator(AnimationUtils.LoadInterpolator(Context, Android.Resource.Animation.AccelerateInterpolator)); outSet.StartDelay = InitialDelay; outSet.AnimationEnd += (sender, e) => { BackgroundTintList = tint; SetImageDrawable(src); JumpDrawablesToCurrentState(); ((Animator)sender).RemoveAllListeners(); }; // Scaling up animation var circleAnimInX = ObjectAnimator.OfFloat(this, "scaleX", 0.1f, 1); var circleAnimInY = ObjectAnimator.OfFloat(this, "scaleY", 0.1f, 1); circleAnimInX.SetDuration(ScaleDuration); circleAnimInY.SetDuration(ScaleDuration); // Alpha in of the icon src.Alpha = 0; var iconAnimIn = ObjectAnimator.OfInt(src, "alpha", 0, 255); iconAnimIn.SetDuration(AlphaDuration); iconAnimIn.StartDelay = AlphaInDelay; var inSet = new AnimatorSet(); inSet.PlayTogether(circleAnimInX, circleAnimInY, iconAnimIn); inSet.SetInterpolator(AnimationUtils.LoadInterpolator(Context, Android.Resource.Animation.DecelerateInterpolator)); switchAnimation = new AnimatorSet(); switchAnimation.PlaySequentially(outSet, inSet); switchAnimation.Start(); }
public void CancelAnimation() { CreateAnimation(); animation.Cancel(); }
public void cancel() { mAnimatorSet.Cancel(); }