Updated to the new optimized keyframe APIs

Also fixed some existing bugs in some of the animation apps

Change-Id: Iff39a8396f8c49e2db8601b04012a0bb784a78ed
This commit is contained in:
Chet Haase
2010-10-23 08:54:43 -07:00
parent 3885c649aa
commit 2d3d5377a8
4 changed files with 13 additions and 14 deletions

View File

@@ -73,8 +73,6 @@ public class AnimationCloning extends Activity {
ShapeHolder ball1 = addBall(150f, 25f);
ShapeHolder ball2 = addBall(250f, 25f);
ShapeHolder ball3 = addBall(350f, 25f);
}
private void createAnimation() {
@@ -91,7 +89,7 @@ public class AnimationCloning extends Activity {
animDown.setInterpolator(new AccelerateInterpolator());
ObjectAnimator animUp = ObjectAnimator.ofFloat(ball2, "y",
getHeight() - ball2.getHeight(), 0f).setDuration(500);
animDown.setInterpolator(new DecelerateInterpolator());
animUp.setInterpolator(new DecelerateInterpolator());
AnimatorSet s1 = new AnimatorSet();
s1.playSequentially(animDown, animUp);
animDown.addUpdateListener(this);

View File

@@ -170,9 +170,9 @@ public class LayoutAnimations extends Activity {
});
// Changing while Removing
Keyframe kf0 = new Keyframe(0f, 0f);
Keyframe kf1 = new Keyframe(.9999f, 360f);
Keyframe kf2 = new Keyframe(1f, 0f);
Keyframe kf0 = Keyframe.ofFloat(0f, 0f);
Keyframe kf1 = Keyframe.ofFloat(.9999f, 360f);
Keyframe kf2 = Keyframe.ofFloat(1f, 0f);
PropertyValuesHolder pvhRotation =
PropertyValuesHolder.ofKeyframe("rotation", kf0, kf1, kf2);
customChangingDisappearingAnim = ObjectAnimator.ofPropertyValuesHolder(

View File

@@ -136,9 +136,9 @@ public class LayoutAnimationsHideShow extends Activity {
});
// Changing while Removing
Keyframe kf0 = new Keyframe(0f, 0f);
Keyframe kf1 = new Keyframe(.9999f, 360f);
Keyframe kf2 = new Keyframe(1f, 0f);
Keyframe kf0 = Keyframe.ofFloat(0f, 0f);
Keyframe kf1 = Keyframe.ofFloat(.9999f, 360f);
Keyframe kf2 = Keyframe.ofFloat(1f, 0f);
PropertyValuesHolder pvhRotation =
PropertyValuesHolder.ofKeyframe("rotation", kf0, kf1, kf2);
final ObjectAnimator changeOut = ObjectAnimator.ofPropertyValuesHolder(

View File

@@ -109,7 +109,7 @@ public class MultiPropertyAnimation extends Activity {
ball.getHeight() * 2);
PropertyValuesHolder pvTX = PropertyValuesHolder.ofFloat("x", ball.getX(),
ball.getX() - BALL_SIZE/2f);
PropertyValuesHolder pvTY = PropertyValuesHolder.ofFloat("y", 0f, ball.getY(),
PropertyValuesHolder pvTY = PropertyValuesHolder.ofFloat("y", ball.getY(),
ball.getY() - BALL_SIZE/2f);
ObjectAnimator whxyBouncer = ObjectAnimator.ofPropertyValuesHolder(ball, pvhW, pvhH,
pvTX, pvTY).setDuration(DURATION/2);
@@ -119,9 +119,9 @@ public class MultiPropertyAnimation extends Activity {
ball = balls.get(3);
pvhY = PropertyValuesHolder.ofFloat("y", ball.getY(), getHeight() - BALL_SIZE);
float ballX = ball.getX();
Keyframe kf0 = new Keyframe(0f, ballX);
Keyframe kf1 = new Keyframe(.5f, ballX + 100f);
Keyframe kf2 = new Keyframe(1f, ballX + 50f);
Keyframe kf0 = Keyframe.ofFloat(0f, ballX);
Keyframe kf1 = Keyframe.ofFloat(.5f, ballX + 100f);
Keyframe kf2 = Keyframe.ofFloat(1f, ballX + 50f);
PropertyValuesHolder pvhX = PropertyValuesHolder.ofKeyframe("x", kf0, kf1, kf2);
ObjectAnimator yxBouncer = ObjectAnimator.ofPropertyValuesHolder(ball, pvhY,
pvhX).setDuration(DURATION/2);
@@ -130,7 +130,8 @@ public class MultiPropertyAnimation extends Activity {
bounceAnim = new AnimatorSet();
((AnimatorSet)bounceAnim).playTogether(yBouncer, yAlphaBouncer, whxyBouncer, yxBouncer);
((AnimatorSet)bounceAnim).playTogether(yBouncer, yAlphaBouncer, whxyBouncer,
yxBouncer);
}
}