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:
@@ -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);
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user