Partager via


ValueAnimator.SetCurrentFraction(Single) Method

Definition

Sets the position of the animation to the specified fraction.

[Android.Runtime.Register("setCurrentFraction", "(F)V", "GetSetCurrentFraction_FHandler", ApiSince=22)]
public virtual void SetCurrentFraction (float fraction);
[<Android.Runtime.Register("setCurrentFraction", "(F)V", "GetSetCurrentFraction_FHandler", ApiSince=22)>]
abstract member SetCurrentFraction : single -> unit
override this.SetCurrentFraction : single -> unit

Parameters

fraction
Single

The fraction to which the animation is advanced or rewound. Values outside the range of 0 to the maximum fraction for the animator will be clamped to the correct range.

Attributes

Remarks

Sets the position of the animation to the specified fraction. This fraction should be between 0 and the total fraction of the animation, including any repetition. That is, a fraction of 0 will position the animation at the beginning, a value of 1 at the end, and a value of 2 at the end of a reversing animator that repeats once. If the animation has not yet been started, then it will not advance forward after it is set to this fraction; it will simply set the fraction to this value and perform any appropriate actions based on that fraction. If the animation is already running, then setCurrentFraction() will set the current fraction to this value and continue playing from that point. Animator.AnimatorListener events are not called due to changing the fraction; those events are only processed while the animation is running.

Java documentation for android.animation.ValueAnimator.setCurrentFraction(float).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to