animation and threads, wait - notify???

Discussion in 'Java' started by eeyimaya, Feb 17, 2004.

  1. eeyimaya

    eeyimaya Guest

    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...
     
    eeyimaya, Feb 17, 2004
    #1
    1. Advertising

  2. "eeyimaya" <> schrieb im Newsbeitrag
    news:...
    > 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
     
    Albert Deinbeck, Feb 17, 2004
    #2
    1. Advertising

  3. eeyimaya

    eeyimaya Guest

    thank you very much for your reply. I will try it...



    "Albert Deinbeck" <> wrote in message news:<c0sun9$r6k$06$-online.com>...
    > "eeyimaya" <> schrieb im Newsbeitrag
    > news:...
    > > 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
     
    eeyimaya, Feb 18, 2004
    #3
  4. eeyimaya

    eeyimaya Guest

    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.


    "Albert Deinbeck" <> wrote in message news:<c0sun9$r6k$06$-online.com>...
    > "eeyimaya" <> schrieb im Newsbeitrag
    > news:...
    > > 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
     
    eeyimaya, Feb 18, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Abraham Khalil

    Theads problem - wait and notify

    Abraham Khalil, Sep 3, 2003, in forum: Java
    Replies:
    1
    Views:
    529
    Roedy Green
    Sep 3, 2003
  2. Renato Battaglia
    Replies:
    3
    Views:
    2,821
    Jon Skeet
    Oct 24, 2003
  3. Replies:
    2
    Views:
    747
    Roedy Green
    Oct 9, 2005
  4. Replies:
    1
    Views:
    353
    Gordon Beaton
    Mar 14, 2006
  5. Jason Cavett

    Don't Understand wait() and notify()

    Jason Cavett, Mar 28, 2007, in forum: Java
    Replies:
    27
    Views:
    703
    Martin Gerner
    Apr 27, 2007
Loading...

Share This Page