summaryrefslogtreecommitdiffstats
path: root/core/java/android/animation/FloatKeyframeSet.java
diff options
context:
space:
mode:
authorChet Haase <chet@google.com>2011-02-11 15:21:35 -0800
committerChet Haase <chet@google.com>2011-02-11 15:21:35 -0800
commit750e12e18f7ce9654cadf11b9e933afb29b59311 (patch)
tree71478eaa32acf708771c8ed4bc908552b2c410e8 /core/java/android/animation/FloatKeyframeSet.java
parent83a7b963f0070022d98853ea1fb4fa5c81cc5e79 (diff)
downloadframeworks_base-750e12e18f7ce9654cadf11b9e933afb29b59311.zip
frameworks_base-750e12e18f7ce9654cadf11b9e933afb29b59311.tar.gz
frameworks_base-750e12e18f7ce9654cadf11b9e933afb29b59311.tar.bz2
Fix when >2 keyframes supplied
When there are more than two keyframes, we treat each keyframe interval as its own separate period during which to calculate animated values. To do this, we calculate an intervaleFraction from the overall elapsed fraction of the entire animation. This intervalFraction is then used to calculate the animated values in that interval. However, we failed to actually use the intervalFraction in some code paths, using the overall fraction instead. This caused a jumping behavior because we were incorrectly calculating the values during the intervals. Change-Id: Ia052e1e8b5130ff450ee20c0a3581e3de42399e1
Diffstat (limited to 'core/java/android/animation/FloatKeyframeSet.java')
-rw-r--r--core/java/android/animation/FloatKeyframeSet.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/core/java/android/animation/FloatKeyframeSet.java b/core/java/android/animation/FloatKeyframeSet.java
index 4009f13..377b5a0 100644
--- a/core/java/android/animation/FloatKeyframeSet.java
+++ b/core/java/android/animation/FloatKeyframeSet.java
@@ -87,7 +87,7 @@ class FloatKeyframeSet extends KeyframeSet {
}
float intervalFraction = (fraction - prevFraction) / (nextFraction - prevFraction);
return mEvaluator == null ?
- prevValue + fraction * (nextValue - prevValue) :
+ prevValue + intervalFraction * (nextValue - prevValue) :
((Number)mEvaluator.evaluate(intervalFraction, prevValue, nextValue)).
floatValue();
} else if (fraction >= 1f) {
@@ -103,7 +103,7 @@ class FloatKeyframeSet extends KeyframeSet {
}
float intervalFraction = (fraction - prevFraction) / (nextFraction - prevFraction);
return mEvaluator == null ?
- prevValue + fraction * (nextValue - prevValue) :
+ prevValue + intervalFraction * (nextValue - prevValue) :
((Number)mEvaluator.evaluate(intervalFraction, prevValue, nextValue)).
floatValue();
}
@@ -120,7 +120,7 @@ class FloatKeyframeSet extends KeyframeSet {
float prevValue = prevKeyframe.getFloatValue();
float nextValue = nextKeyframe.getFloatValue();
return mEvaluator == null ?
- prevValue + fraction * (nextValue - prevValue) :
+ prevValue + intervalFraction * (nextValue - prevValue) :
((Number)mEvaluator.evaluate(intervalFraction, prevValue, nextValue)).
floatValue();
}