5
Animacje programowe
●
przykład tworzenia animacji przejść w sposób programowy
private Animation inFromLeftAnimation() {
Animation anim = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, -1.0f,
Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, 0.0f);
anim.setDuration(300);
anim.setInterpolator(new AccelerateInterpolator());
return anim;
}
private Animation outToRightAnimation() {
Animation anim = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, +1.0f,
Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, 0.0f);
anim.setDuration(300);
anim.setInterpolator(new AccelerateInterpolator());
return anim;
}
.
.
.