ArcMovement on a BitMap - composite Animations

All your problems with Audio, Video and Images.

ArcMovement on a BitMap - composite Animations

Postby nithin.warier » Fri Mar 13, 2009 8:34 am

Hi,

I am trying to create a arc movement(means both RotateAnimation and TranslateAnimation required) for a bitmap. I can do either rotate or translate movement, but i cant integrate both.

the code which i am trying for this is,

private void createAnim(Canvas canvas) {
anim = new RotateAnimation(0, 180, canvas.getWidth() / 2, canvas
.getHeight() / 2);
anim2 = new TranslateAnimation(
Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0.0f
);
anim.setRepeatMode(Animation.REVERSE);
anim.setRepeatCount(Animation.INFINITE);
anim.setDuration(2500);
anim.setInterpolator(new AccelerateDecelerateInterpolator());

startAnimation(anim);
// startAnimation(anim2);
}

Please guide me in this..

Thanks
Nithin
nithin.warier
Experienced Developer
Experienced Developer
 
Posts: 87
Joined: Thu Feb 28, 2008 12:05 pm
Location: Malappuram Kerala India

Top

Postby nithin.warier » Fri Mar 13, 2009 11:31 am

Now i am trying with AnimationSet, but still i cant move further,

the code i am trying is,

private void createAnim(Canvas canvas) {
AnimationSet set = new AnimationSet(true);
set.setInterpolator(new AccelerateDecelerateInterpolator());

anim = new RotateAnimation(0, 360, canvas.getWidth() / 2, canvas
.getHeight() / 2);
anim.setDuration(5000);
set.addAnimation(anim);

anim2 = new TranslateAnimation(
Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0.0f);
anim2.setDuration(5000);
set.addAnimation(anim2);

set.setRepeatMode(AnimationSet.REVERSE);
set.setRepeatCount(AnimationSet.INFINITE);

startAnimation(anim);
// startAnimation(anim2);
}

If there is any method like startAnimation(AnimationSet), then it will be easy... :x

please guide me...

Thanks
Nithin
nithin.warier
Experienced Developer
Experienced Developer
 
Posts: 87
Joined: Thu Feb 28, 2008 12:05 pm
Location: Malappuram Kerala India

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 11 guests