Loading...
Logo
Processing Forum
melodyout's Profile
1 Posts
2 Responses
0 Followers

Activity Trend

Last 30 days
Show:
Private Message
    Hello world
    I wouldn' say my math skills are horrible, I would rather say I don't have such a skills at all. Whole my life I had deep math phobia, so you can laugh as much as you like, but please tell me:

    How to reset from rotate(PI/3.0); in to normal state?

    I'm calling function which is rotating an image ( there is a guy and the image is his hand ). It goes like this:

    void display() {                                                       // display the guy
        image(dzih,0,0);                                                 // dzih is the name of the guy
        hand();
      }  
      
      void hand() {                                                       // set up his hand under certain angle
        translate(translateX, translateY);                        // So far so good
        rotate(PI/3.0 + angle); // set up angle                  // I don't know that yet, but this will cause trouble soon
        image(rotateHand, handX, handY);                      // display hand   
        
        if (suprise) {                                                       // if start button clicked, move hand
        
                                    // here is the code for hand animation, doesn't really matter
            
        }                                                                         
     
        translate(-translateX,-translateY);                   // reset orgin point
                                                                    
             // And here where my problem begin:

                HOW To reset from this rotate(PI/3.0 + angle) in to normal state? everyting I draw after is rotated! Must be
                silly questions I know, but believe me - I'm not kidding! I have deadline for my coursework tommorow

    Also, I want to create array of samples using Sonia library, and later I want to use random() to play sounds from it when, e.g. mouseClicked(). I think I've set it up properly, but I don't know how to play the samples. Here is what I have:

    Global variables:

          Sample [] sounds = new Sample[3];             // there will be more in it, but for simplicity just 3

    Setup():

          String[] filenames = {"sound1.aiff", "another_sound.aiff", "and_another"};
          for (int i = 0; i < filenames.lenght; i++) {
                sounds[i] = new Sample( filenames[i]);
          }

    I don't know if it's gonna work, because I dont know how to play them randomly later, If anybody could come with the right commends, it will be strongly appreciated. 

    Regards