animation with static background image`

A

azsx

Hi. Can you give me an example of drawing some simple animation on a
static image? Let's say that a red circle has to move over the
background image, can you help? Do I need to do this with threads?
 
O

Oliver Wong

azsx said:
Hi. Can you give me an example of drawing some simple animation on a
static image? Let's say that a red circle has to move over the
background image, can you help?

You usually a completely opaque background, so that the previous frame
has no effect on the appearance of the next frame. Draw the background,
which effectively wipes out all trace of the previous frame, and then draw
your red circle. Drawing from back-to-front like this is known as "Painters
Algorithm".
Do I need to do this with threads?

Whenever you use a GUI like AWT or Swing, they will use threads behind
the scenes. However, you do not need to explicitly create any threads over
the ones that AWT/Swing creates for you, if all you want to do is draw some
animations.

- Oliver
 
A

azsx

You usually a completely opaque background, so that the previous frame
has no effect on the appearance of the next frame. Draw the background,
which effectively wipes out all trace of the previous frame, and then draw
your red circle. Drawing from back-to-front like this is known as "Painters
Algorithm".

please give me an example or some links...
My problemm is like this: using threads simulate the rotation of
planets arround Sun. All animation is done over some background image
that the user can change... Animation should have play/pause option.
Can you give me some ideas?
 
O

Oliver Wong

azsx said:
please give me an example or some links...
My problemm is like this: using threads simulate the rotation of
planets arround Sun. All animation is done over some background image
that the user can change... Animation should have play/pause option.
Can you give me some ideas?

When I google for "java animation example", I get
http://kawigi.yajags.com/animation/

- Oliver
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,270
Messages
2,571,102
Members
48,773
Latest member
Kaybee

Latest Threads

Top