// Overridden from IAnimatorUpdateListener public void OnAnimationUpdate(ValueAnimator va) { if (root.Bottom > list.Height) { if (root.Top > 0) { int yDelta = root.Bottom - list.Height + list.PaddingBottom; list.SmoothScrollBy(Math.Min(yDelta, root.Top), 0); } } }
public void OnAnimationUpdate(ValueAnimator animation) { if (MusicBar.IsTracking || !MusicBar.IsAutoProgress) { MusicBar.ClearProgressAnimator(); } else { MusicBar.SetAutoProgressPosition((int)animation.AnimatedValue); } }
/// <summary> /// Creates the actual animator instance /// </summary> internal static IValueAnimator Create(Timeline timeline, double startingValue, double targetValue) { if (timeline.GetIsDependantAnimation() || timeline.GetIsDurationZero()) { return(new NativeValueAnimatorAdapter(ValueAnimator.OfFloat((float)startingValue, (float)targetValue))); } else { return(timeline.GetGPUAnimator(startingValue, targetValue)); } }
public PracticeImageViewRenderer(Context context) : base(context) { Console.WriteLine("new PracticeImageRenderer created" + System.Environment.NewLine); matrix = new ColorMatrix(); saturation = 1f; zoom = SelfControl.Helpers.GlobalVariables.StartingZoomValue; isHeating = false; isCooling = false; animationSat = null; animationZoomIn = null; }
/// <summary> /// OnAnimationUpdate /// </summary> /// <param name="animation"></param> public void OnAnimationUpdate(ValueAnimator animation) { ViewGroup.LayoutParams pars = _tab.LayoutParameters; if (pars == null) { return; } pars.Width = (int)Math.Round((float)_animator.AnimatedValue); _tab.LayoutParameters = pars; }
public void OnAnimationUpdate(ValueAnimator animation) { int value = Convert.ToInt32(animation.AnimatedValue); if (value != 0) { ViewGroup.LayoutParams layoutParams = _mView.LayoutParameters; layoutParams.Height = value; _mView.LayoutParameters = layoutParams; } }
public void AnimateColorPercent(float percent, int duration) { ValueAnimator valueAnimator = ValueAnimator.OfFloat(LastPercent, percent); valueAnimator.Update += (sender, args) => { SetColorPercent((float)valueAnimator.AnimatedValue); }; valueAnimator.SetDuration(duration); valueAnimator.Start(); }
private void simulateErrorProgress(CirButton button) { this.cirbutton = button; success = false; ValueAnimator widthAnimation = ValueAnimator.OfInt(1, 99); widthAnimation.SetDuration(1500); widthAnimation.SetInterpolator(new AccelerateDecelerateInterpolator()); widthAnimation.AddUpdateListener(this); widthAnimation.Start(); }
private Animator getIndicatorAnimator(float from, float to) { var animIndicator = ValueAnimator.OfFloat(from, to); animIndicator.SetDuration(INDICATOR_ANIM_DURATION_MILLIS); animIndicator.SetInterpolator(new OvershootInterpolator()); animIndicator.AddUpdateListener(new CustomUpdateListener(this)); animIndicator.AddListener(new CustomAnimatorListener(this)); return(animIndicator); }
public void OnAnimationUpdate(ValueAnimator animation) { try { float v = (float)animation.AnimatedValue; _speaker.Play(v); } catch (Exception e) { throw new Exception("Error sliding speaker", e); } }
private void FadeDimBackground(int from, int to) { var anim = ValueAnimator.OfInt(from, to); anim.Update += (sender, e) => { var value = (int)e.Animation.AnimatedValue; mDimDrawable.Alpha = value; }; anim.SetDuration(ANIM_DURATION); anim.Start(); }
private void StartCountAnimation(int humidityPercentage) { ValueAnimator animator = ValueAnimator.OfInt(0, humidityPercentage); animator.SetDuration(1000); animator.Start(); animator.Update += (object sender, ValueAnimator.AnimatorUpdateEventArgs e) => { int newValue = (int)e.Animation.AnimatedValue; percentageIncrease.Text = Convert.ToString(newValue) + "%"; }; }
public static ValueAnimator MakeDeterminateCircularPrimaryProgressAnimator(ProgressBar[] progressBars) { ValueAnimator animator = ValueAnimator.OfInt(0, 150); animator.SetDuration(6000); animator.SetInterpolator(new LinearInterpolator()); animator.RepeatCount = ValueAnimator.Infinite; animator.AddUpdateListener(new DeterminateCircularPrimaryProgressAnimatorListener(animator, progressBars)); return(animator); }
// Animate Marker on the map between retrieving positions // Not working with MapBox for now private void AnimateMarkerOnMap(Icon icon, MarkerOptions markerToUpdate, LatLng newPosition, double?compassCourse, LatLng oldPosition) { markerToUpdate.InvokeIcon(icon); var evaluator = new LatLngEvaluator(); var valueAnimator = ValueAnimator.OfObject(evaluator, new LatLng(oldPosition.Latitude, oldPosition.Longitude), newPosition); valueAnimator.AddUpdateListener(new MarkerAnimatorAdapter(markerToUpdate)); valueAnimator.SetDuration(5000); valueAnimator.SetInterpolator(new Android.Views.Animations.LinearInterpolator()); valueAnimator.Start(); }
private void CloseMenu(View back, View front, float x) { var anim = ValueAnimator.OfFloat(x, mFrontWidth); anim.SetDuration(300); anim.Update += (o, eventArgs) => { back.TranslationX = (float)eventArgs.Animation.AnimatedValue; front.TranslationX = (float)eventArgs.Animation.AnimatedValue - mFrontWidth; }; anim.Start(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.main_activity); mDeterminateCircularProgressBars = this.BindViews <ProgressBar>(Resource.Id.determinate_circular_large_progress, Resource.Id.determinate_circular_progress, Resource.Id.determinate_circular_small_progress); mDeterminateCircularProgressAnimator = Animators.MakeDeterminateCircularPrimaryProgressAnimator(mDeterminateCircularProgressBars); }
public ShineView(Context context, ShineButtonControl shineButton, ShineParams shineParams, ColourSet randomColourSet = null) : base(context) { // Populate a custom selection of random colours if provided if (randomColourSet != null && randomColourSet.ColourSelection?.Length != 0) { suppliedColorRandom = randomColourSet.ColourSelection; } InitShineParams(shineParams, shineButton); this.shineAnimator = new ShineAnimator(animDuration, shineDistanceMultiple, clickAnimDuration); ValueAnimator.FrameDelay = FRAME_REFRESH_DELAY; this.shineButton = shineButton; paint = new Paint(); paint.Color = bigShineColor; paint.StrokeWidth = 20; paint.SetStyle(Paint.Style.Stroke); paint.StrokeCap = Paint.Cap.Round; paint2 = new Paint(); paint2.Color = Color.White; paint2.StrokeWidth = 20; paint2.StrokeCap = Paint.Cap.Round; paintSmall = new Paint(); paintSmall.Color = smallShineColor; paintSmall.StrokeWidth = 10; paintSmall.SetStyle(Paint.Style.Stroke); paintSmall.StrokeCap = Paint.Cap.Round; clickAnimator = ValueAnimator.OfFloat(0f, 1.1f); ValueAnimator.FrameDelay = FRAME_REFRESH_DELAY; clickAnimator.SetDuration(clickAnimDuration); clickAnimator.SetInterpolator(new EasingInterpolator(Ease.QuartOut)); clickAnimator.Update += (s, e) => { clickValue = (float)e.Animation.AnimatedValue; Invalidate(); }; clickAnimator.AnimationEnd += (s, e) => { clickValue = 0; Invalidate(); }; shineAnimator.AnimationEnd += (s, e) => { shineButton.RemoveView(this); }; }
void Start(long secs) { timerAnimator = ValueAnimator.OfFloat(0f, Rating); timerAnimator.SetDuration(Java.Util.Concurrent.TimeUnit.Seconds.ToMillis(secs)); timerAnimator.SetInterpolator(new AccelerateInterpolator()); timerAnimator.Update += (sender, e) => { currentRating = (float)e.Animation.AnimatedValue; Invalidate(); }; timerAnimator.Start(); }
public void OnAnimationUpdate(ValueAnimator animation) { int bottom = v.Bottom; if (bottom > listViewHeight) { int top = v.Top; if (top > 0) { mlist.smoothScrollBy(Math.Min(bottom - listViewHeight + listViewBottomPadding, top), 0); } } }
ValueAnimator slideAnimator(int start, int end, LinearLayout content) { ValueAnimator animator = ValueAnimator.OfInt(start, end); animator.Update += (object sender, ValueAnimator.AnimatorUpdateEventArgs e) => { var value = (int)animator.AnimatedValue; ViewGroup.LayoutParams layoutParams = content.LayoutParameters; layoutParams.Height = value; content.LayoutParameters = layoutParams; }; return(animator); }
public NativeValueAnimatorAdapter(ValueAnimator adaptee, Action prepareAnimation, Action completeAnimation) { _adaptee = adaptee; if (prepareAnimation != null && completeAnimation != null) { _prepareAnimation = prepareAnimation; // We register the 'completeAnimation' callback as soon as possible , // so it will be the first callback and won't conflict with an other animator which would be // started in other completion callbacks (e.g. RepeatMode.Forever) _adaptee.AnimationEnd += (snd, args) => completeAnimation(); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.ValueAnimator); var seekBar = FindViewById <SeekBar>(Resource.Id.SeekBarValueAnimator); ValueAnimator colorAnim = ObjectAnimator.OfInt(seekBar, "progress", 0, 100); colorAnim.SetDuration(1000); colorAnim.Start(); }
private void CreateWarningAnimation() { // Create animation. int fromColor = DefaultColor.ToArgb(); int toColor = WarningColor.ToArgb(); _warningAnimation = ObjectAnimator.OfInt(_remainingView, "backgroundColor", fromColor, toColor); _warningAnimation.SetEvaluator(new ArgbEvaluator()); _warningAnimation.SetInterpolator(new LinearInterpolator()); _warningAnimation.SetDuration(250); _warningAnimation.RepeatMode = ValueAnimatorRepeatMode.Reverse; _warningAnimation.RepeatCount = -1; //infinite }
public static ValueAnimator AnimateAlpha(View view, int start, int end) { ValueAnimator animator = ValueAnimator.OfInt(start, end); animator.SetInterpolator(new LinearInterpolator()); animator.Update += (object sender, ValueAnimator.AnimatorUpdateEventArgs e) => { var value = (int)animator.AnimatedValue; view.Alpha = value; }; return(animator); }
public DroidAnimator FloatValue(float fromValue, float toValue, double?durationSeconds, double?delaySeconds, AnimationInterpolation?interpolation) { return(base.ExecuteFunction <DroidAnimator>("FloatValue", delegate() { ValueAnimator textValueAnimator = ValueAnimator.OfFloat(fromValue, toValue); textValueAnimator.SetEvaluator(new FloatEvaluator()); SetDefaultsFor(textValueAnimator, durationSeconds, delaySeconds, interpolation); textValueAnimator.Update += textValueAnimator_Float_Update; _animators.Add(textValueAnimator); return this; })); }
private void StartScaleCircleAnimation() { ValueAnimator valueCircleAnimator = ValueAnimator.OfFloat(circleRadius + strokeWidth / 2, circleMaxRadius); valueCircleAnimator.SetDuration(1000); valueCircleAnimator.Update += (s, e) => { currentCircleRadius = (float)e.Animation.AnimatedValue; Invalidate(); }; valueCircleAnimator.Start(); }
protected void Init(float duration, AnimationUpdate updateDelegate, AnimationComplete completeDelegate) { Animator = ValueAnimator.OfFloat(0.00f, 1.00f); Animator.AddUpdateListener(this); Animator.AddListener(this); // convert duration to milliseconds Animator.SetDuration((int)(duration * 1000.0f)); AnimationUpdateDelegate = updateDelegate; AnimationCompleteDelegate = completeDelegate; }
public void OnAnimationUpdate(ValueAnimator animation) { int progress = (int)animation.AnimatedValue; mLineProgressBar.Progress = progress; mSolidProgressBar.Progress = progress; mCustomProgressBar1.Progress = progress; mCustomProgressBar2.Progress = progress; mCustomProgressBar3.Progress = progress; mCustomProgressBar4.Progress = progress; mCustomProgressBar5.Progress = progress; mCustomProgressBar6.Progress = progress; }
private ValueAnimator BuildAnimator(int start, int end, View view) { var animator = ValueAnimator.OfInt(start, end); animator.Update += (object sender, ValueAnimator.AnimatorUpdateEventArgs e) => { var value = (int)animator.AnimatedValue; ViewGroup.LayoutParams layoutParams = view.LayoutParameters; layoutParams.Height = value; view.LayoutParameters = layoutParams; }; return(animator); }
private void StopScrolling() { try { _isScrolling = false; ValueAnimator.Cancel("Scrolling"); _modsScrollablePanel.scrollPosition = Vector2.zero; } catch (Exception e) { Debug.Log("[Stream It!] StreamManager:StopScrolling -> Exception: " + e.Message); } }