Saturday, March 19, 2011

[android-developers] Canvas frame rate very choppy in Live Wallpaper

I'm trying to make a simple (or so I thought) live wallpaper that
takes an image and moves it slowly in a circular motion, to make the
picture seem less static and more like looking out a window. I took
the live wallpaper tutorial from the SDK and stripped it down to the
bare bones so I could add to it. But the issue is that no matter what
size the image I'm moving, or what format (drawable or bitmap), it is
only getting about 3 fps.

I don't know what to do to make this run faster, I have very limited
programming knowledge so I don't know if I'm missing something stupid.

Also, this is the code I'm using to calculate the circular movement:

int NewX = (int) (OffsetX + Math.sin(Dist)*19);
int NewY = (int) (OffsetY + Math.cos(Dist)*19);


where Dist is the speed it's moving and 19 is the radius of the
circle.

Is there an easier way? I looked into Tween animation but I don't know
how I would implement my circle code into it.

--
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