animation and threads, wait - notify???

E

eeyimaya

Hello,
I am working on a program that includes a lot of animations.
Most of the animations occurs at the same time. For example
one of the scenarios is this:
first, one man comes from left and asks a question to the 3 creatures
Then 3 creatures answers sequentialy. And then start the changing
their faces
(all of the 3 creatures at the same time. i.e. 3 different
animations).
After 3 creatures stop the changing their faces; scenario ends. man
goes to the right by talking himself.

All of these animations occurs at a different fps

NOW, QUESTIONS:
Do I need one thread for each animations.ie, for man walking, first
creature talk,
second creature talk, third creature talk, first creature change face,
second creature change face,
third creature change face, man walks to the right, man talks
himself....

How do I achieve that when one thread (for example first creature
talk) ends,
the second starts(for example second creature talk.) I used one
thread for each animations and
when one starts others wait. I used "BUSY WAIT" but it performed very
badly. Tried to use
"wait- notify()" but could not achieve. DO YOU KNOW ANY LINK ABOUT
ANIMATIONS THAT USE wait-notify ?
I searched but every example just animating a single images!!!

Any help will be very appreciated...
 
A

Albert Deinbeck

eeyimaya said:
Hello,
I am working on a program that includes a lot of animations.
Most of the animations occurs at the same time. For example
one of the scenarios is this:
first, one man comes from left and asks a question to the 3 creatures
Then 3 creatures answers sequentialy. And then start the changing
their faces
(all of the 3 creatures at the same time. i.e. 3 different
animations).
After 3 creatures stop the changing their faces; scenario ends. man
goes to the right by talking himself.

All of these animations occurs at a different fps

NOW, QUESTIONS:
Do I need one thread for each animations.ie, for man walking, first
creature talk,
second creature talk, third creature talk, first creature change face,
second creature change face,
third creature change face, man walks to the right, man talks
himself....

How do I achieve that when one thread (for example first creature
talk) ends,
the second starts(for example second creature talk.) I used one
thread for each animations and
when one starts others wait. I used "BUSY WAIT" but it performed very
badly. Tried to use
"wait- notify()" but could not achieve. DO YOU KNOW ANY LINK ABOUT
ANIMATIONS THAT USE wait-notify ?
I searched but every example just animating a single images!!!

Any help will be very appreciated...

OK...
I would make one thread per animation and one controller thread:
public static void main(..){
AnimationThread manWalk = new AnimationThread(animationData);
AnimationThread firstTalk = new
....,secondTalk...,thirdTalk...,firstFace...,secondFace...,thirdface...
manWalk.start();
manWalk.join();
firstTalk.start();
firstTalk.join();
secondTalk.start();
secondTalk.join();
thirdTalk.start();
thirdTalk.join();
firstFace.start();
secondFace.start();
thirdFace.start();
firstFace.join();
secondFace.join();
thirdFace.join();
}
The main thread does the synchronization by waiting for threads to complete.
I wouldn't use wait/notify in this case.

Albert
 
E

eeyimaya

Thank you very much for your reply. But I could not understand that
how can I stop the running threads if I need. For example when I open
a menu I want animations stops and wait. Also if there are more than
one thread occurs at the same time will this run?
Ertan.
 

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

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,119
Latest member
IrmaNorcro
Top