Merge "Updated to the new optimized keyframe APIs"
This commit is contained in:
@@ -73,8 +73,6 @@ public class AnimationCloning extends Activity {
|
|||||||
ShapeHolder ball1 = addBall(150f, 25f);
|
ShapeHolder ball1 = addBall(150f, 25f);
|
||||||
ShapeHolder ball2 = addBall(250f, 25f);
|
ShapeHolder ball2 = addBall(250f, 25f);
|
||||||
ShapeHolder ball3 = addBall(350f, 25f);
|
ShapeHolder ball3 = addBall(350f, 25f);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createAnimation() {
|
private void createAnimation() {
|
||||||
@@ -91,7 +89,7 @@ public class AnimationCloning extends Activity {
|
|||||||
animDown.setInterpolator(new AccelerateInterpolator());
|
animDown.setInterpolator(new AccelerateInterpolator());
|
||||||
ObjectAnimator animUp = ObjectAnimator.ofFloat(ball2, "y",
|
ObjectAnimator animUp = ObjectAnimator.ofFloat(ball2, "y",
|
||||||
getHeight() - ball2.getHeight(), 0f).setDuration(500);
|
getHeight() - ball2.getHeight(), 0f).setDuration(500);
|
||||||
animDown.setInterpolator(new DecelerateInterpolator());
|
animUp.setInterpolator(new DecelerateInterpolator());
|
||||||
AnimatorSet s1 = new AnimatorSet();
|
AnimatorSet s1 = new AnimatorSet();
|
||||||
s1.playSequentially(animDown, animUp);
|
s1.playSequentially(animDown, animUp);
|
||||||
animDown.addUpdateListener(this);
|
animDown.addUpdateListener(this);
|
||||||
|
|||||||
@@ -170,9 +170,9 @@ public class LayoutAnimations extends Activity {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Changing while Removing
|
// Changing while Removing
|
||||||
Keyframe kf0 = new Keyframe(0f, 0f);
|
Keyframe kf0 = Keyframe.ofFloat(0f, 0f);
|
||||||
Keyframe kf1 = new Keyframe(.9999f, 360f);
|
Keyframe kf1 = Keyframe.ofFloat(.9999f, 360f);
|
||||||
Keyframe kf2 = new Keyframe(1f, 0f);
|
Keyframe kf2 = Keyframe.ofFloat(1f, 0f);
|
||||||
PropertyValuesHolder pvhRotation =
|
PropertyValuesHolder pvhRotation =
|
||||||
PropertyValuesHolder.ofKeyframe("rotation", kf0, kf1, kf2);
|
PropertyValuesHolder.ofKeyframe("rotation", kf0, kf1, kf2);
|
||||||
customChangingDisappearingAnim = ObjectAnimator.ofPropertyValuesHolder(
|
customChangingDisappearingAnim = ObjectAnimator.ofPropertyValuesHolder(
|
||||||
|
|||||||
@@ -136,9 +136,9 @@ public class LayoutAnimationsHideShow extends Activity {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Changing while Removing
|
// Changing while Removing
|
||||||
Keyframe kf0 = new Keyframe(0f, 0f);
|
Keyframe kf0 = Keyframe.ofFloat(0f, 0f);
|
||||||
Keyframe kf1 = new Keyframe(.9999f, 360f);
|
Keyframe kf1 = Keyframe.ofFloat(.9999f, 360f);
|
||||||
Keyframe kf2 = new Keyframe(1f, 0f);
|
Keyframe kf2 = Keyframe.ofFloat(1f, 0f);
|
||||||
PropertyValuesHolder pvhRotation =
|
PropertyValuesHolder pvhRotation =
|
||||||
PropertyValuesHolder.ofKeyframe("rotation", kf0, kf1, kf2);
|
PropertyValuesHolder.ofKeyframe("rotation", kf0, kf1, kf2);
|
||||||
final ObjectAnimator changeOut = ObjectAnimator.ofPropertyValuesHolder(
|
final ObjectAnimator changeOut = ObjectAnimator.ofPropertyValuesHolder(
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ public class MultiPropertyAnimation extends Activity {
|
|||||||
ball.getHeight() * 2);
|
ball.getHeight() * 2);
|
||||||
PropertyValuesHolder pvTX = PropertyValuesHolder.ofFloat("x", ball.getX(),
|
PropertyValuesHolder pvTX = PropertyValuesHolder.ofFloat("x", ball.getX(),
|
||||||
ball.getX() - BALL_SIZE/2f);
|
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);
|
ball.getY() - BALL_SIZE/2f);
|
||||||
ObjectAnimator whxyBouncer = ObjectAnimator.ofPropertyValuesHolder(ball, pvhW, pvhH,
|
ObjectAnimator whxyBouncer = ObjectAnimator.ofPropertyValuesHolder(ball, pvhW, pvhH,
|
||||||
pvTX, pvTY).setDuration(DURATION/2);
|
pvTX, pvTY).setDuration(DURATION/2);
|
||||||
@@ -119,9 +119,9 @@ public class MultiPropertyAnimation extends Activity {
|
|||||||
ball = balls.get(3);
|
ball = balls.get(3);
|
||||||
pvhY = PropertyValuesHolder.ofFloat("y", ball.getY(), getHeight() - BALL_SIZE);
|
pvhY = PropertyValuesHolder.ofFloat("y", ball.getY(), getHeight() - BALL_SIZE);
|
||||||
float ballX = ball.getX();
|
float ballX = ball.getX();
|
||||||
Keyframe kf0 = new Keyframe(0f, ballX);
|
Keyframe kf0 = Keyframe.ofFloat(0f, ballX);
|
||||||
Keyframe kf1 = new Keyframe(.5f, ballX + 100f);
|
Keyframe kf1 = Keyframe.ofFloat(.5f, ballX + 100f);
|
||||||
Keyframe kf2 = new Keyframe(1f, ballX + 50f);
|
Keyframe kf2 = Keyframe.ofFloat(1f, ballX + 50f);
|
||||||
PropertyValuesHolder pvhX = PropertyValuesHolder.ofKeyframe("x", kf0, kf1, kf2);
|
PropertyValuesHolder pvhX = PropertyValuesHolder.ofKeyframe("x", kf0, kf1, kf2);
|
||||||
ObjectAnimator yxBouncer = ObjectAnimator.ofPropertyValuesHolder(ball, pvhY,
|
ObjectAnimator yxBouncer = ObjectAnimator.ofPropertyValuesHolder(ball, pvhY,
|
||||||
pvhX).setDuration(DURATION/2);
|
pvhX).setDuration(DURATION/2);
|
||||||
@@ -130,7 +130,8 @@ public class MultiPropertyAnimation extends Activity {
|
|||||||
|
|
||||||
|
|
||||||
bounceAnim = new AnimatorSet();
|
bounceAnim = new AnimatorSet();
|
||||||
((AnimatorSet)bounceAnim).playTogether(yBouncer, yAlphaBouncer, whxyBouncer, yxBouncer);
|
((AnimatorSet)bounceAnim).playTogether(yBouncer, yAlphaBouncer, whxyBouncer,
|
||||||
|
yxBouncer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user