summaryrefslogtreecommitdiffstats
path: root/core/java/android/animation
diff options
context:
space:
mode:
authorChet Haase <chet@google.com>2011-02-22 06:34:40 -0800
committerChet Haase <chet@google.com>2011-02-25 06:47:53 -0800
commita00f3865f55c5c9cb74510ee2b239d101230133c (patch)
tree4422efdd9ffd172caaffb576cf81a0b266b76ee5 /core/java/android/animation
parent11f4ae76f016d72486aedd33cfef47ba41e6592e (diff)
downloadframeworks_base-a00f3865f55c5c9cb74510ee2b239d101230133c.zip
frameworks_base-a00f3865f55c5c9cb74510ee2b239d101230133c.tar.gz
frameworks_base-a00f3865f55c5c9cb74510ee2b239d101230133c.tar.bz2
Add ViewPropertyAnimator for easy animation of View properties
Change-Id: I2bc52ca16507d8d20004d2d6823e587791272aac
Diffstat (limited to 'core/java/android/animation')
-rwxr-xr-xcore/java/android/animation/ValueAnimator.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/core/java/android/animation/ValueAnimator.java b/core/java/android/animation/ValueAnimator.java
index b963117..f562851 100755
--- a/core/java/android/animation/ValueAnimator.java
+++ b/core/java/android/animation/ValueAnimator.java
@@ -160,6 +160,11 @@ public class ValueAnimator extends Animator {
private int mCurrentIteration = 0;
/**
+ * Tracks current elapsed/eased fraction, for querying in getAnimatedFraction().
+ */
+ private float mCurrentFraction = 0f;
+
+ /**
* Tracks whether a startDelay'd animation has begun playing through the startDelay.
*/
private boolean mStartedDelay = false;
@@ -1111,6 +1116,16 @@ public class ValueAnimator extends Animator {
}
/**
+ * Returns the current animation fraction, which is the elapsed/interpolated fraction used in
+ * the most recent frame update on the animation.
+ *
+ * @return Elapsed/interpolated fraction of the animation.
+ */
+ public float getAnimatedFraction() {
+ return mCurrentFraction;
+ }
+
+ /**
* This method is called with the elapsed fraction of the animation during every
* animation frame. This function turns the elapsed fraction into an interpolated fraction
* and then into an animated value (from the evaluator. The function is called mostly during
@@ -1124,6 +1139,7 @@ public class ValueAnimator extends Animator {
*/
void animateValue(float fraction) {
fraction = mInterpolator.getInterpolation(fraction);
+ mCurrentFraction = fraction;
int numValues = mValues.length;
for (int i = 0; i < numValues; ++i) {
mValues[i].calculateValue(fraction);