Sunday, September 4, 2011

[android-developers] Re: Animating a graphics shape.

The Android animation tools are mostly pointed at animations that can
be performed by making graphical transformations on a single scene:
making a page turn, wipes, fades, etc. This is what Android calls
"tweened" animation. I think you are thinking of something they call
"frame-by-frame" animation. The Android tool for managing this is a
Drawable: http://developer.android.com/reference/android/graphics/drawable/AnimationDrawable.html.
It is pretty limited... I don't think you'll want to base a game on
it.

Erasing the old shape and drawing the new one is pretty much how you
do a 2d animation. 2-d drawing happens on a Canvas. There are a lot
of ways to optimize the process. Be careful, though, because the way
Android does basic graphics changes a lot, for Honeycomb. Things that
used to be optimizations (in particular, composing backgrounds and
saving them as bitmaps), may actually slow things down.

Probably the fastest way to draw uses OpenGL and the SurfaceView.
It's like learning an entirely new, fairly complex, machine language.
It might be overkill for a simple 2-d game.

-blake
Programming Android, FTW!
http://oreilly.com/catalog/0636920010364

On Sep 3, 9:42 am, Tobiah <t...@tobiah.org> wrote:
> I want to make a vector style 2d video game.  I started
> with a subclass of View.  I can draw shapes on it.  Now
> I want them to move.  I could erase and draw new shapes,
> but I know if I do that, I won't get a chance to see the
> movement on the screen until my routine is done.
>
> I guess I need another thread to do the drawing.  Can
> someone point me in the right direction?  Are there
> sprite style facilities that I should look at?  Do I
> need android.Animation, or android.view.Animation?
> Should I be looking at Canvas, or SurfaceView?
>
> Thanks,
>
> Tobiah

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate