Translate animation problem

Problems with Canvas, OpenGL, etc...

Translate animation problem

Postby chiara » Thu Feb 24, 2011 5:41 pm

Hi,

I am working on a board game. I have a board and pieces over its positions.
I have a PieceView that draw the piece's drawable bitmap on the corresponding position.

Now I want to translate this piece to another position (up, down, left or right). I made a TranslateAnimation, and it almost work, the problem is when the animation end, the piece go bak to his previous position. I suposse that it make a redraw once the animation finished.

Do you know how to avoid the last redraw?

Regards,
Chiara
chiara
Freshman
Freshman
 
Posts: 5
Joined: Wed May 05, 2010 12:13 am

Top

Re: Translate animation problem

Postby MichaelEGR » Thu Feb 24, 2011 10:34 pm

The android.view.animation system only animates / moves the drawing of the view, but does not update the location of a given view in a container after the animation is finished. The most recent Android dev blog post from Chet explains the new animation system in Honeycomb, but also the deficiency in the old system you are running into:
http://android-developers.blogspot.com/ ... ycomb.html

I recommend that you consider making one custom view for the game board and that you manage and draw the bitmaps directly including any animation updates. The android view.animation package is really meant for simple GUI animations and not so much for a game even a basic one.
Founder & Principal Architect; EGR Software LLC
http://www.typhonrt.org
http://www.egrsoftware.com
User avatar
MichaelEGR
Senior Developer
Senior Developer
 
Posts: 147
Joined: Thu Jan 21, 2010 5:30 am
Location: San Francisco, CA

Re: Translate animation problem

Postby chiara » Tue Mar 01, 2011 9:35 pm

Hi Michael, thanks for your response, I find out how to make it work by extending ViewGroup witch contains all the pieces views and by animating them with an extra imgView.

Regards,
Chiara
chiara
Freshman
Freshman
 
Posts: 5
Joined: Wed May 05, 2010 12:13 am

Top

Return to Android 2D/3D Graphics - OpenGL Problems

Who is online

Users browsing this forum: No registered users and 3 guests