Loading...
Logo
Processing Forum
maronid's Profile
4 Posts
6 Responses
0 Followers

Activity Trend

Last 30 days

Loading Chart...

Show:
Private Message
    Hi, i am trying to playback many audio files with Minim SamplePlayer but I cannot get anything after 32th sample

    Any solutions?

    Also do you think it is good idea to to work with JUST processing or combination of Processing + Max/MSP or Supercollider?
    Hi,

    I am trying to make lines that connect shapes to be in the background but I am probably missing something.
    Any help?


    int numBalls = 14;
    int[] drivingArray = new int[numBalls];
    Ball[] balls = new Ball[numBalls];


    //for (int i = 0; i < myArray.length; i++){

    void setup() 
    {
      size(displayWidth - 20, 300);
      frame.setBackground(new java.awt.Color(0, 0, 0)); 

      for (int d = 0; d < numBalls; d++) {

        drivingArray[d] = int(random(0, width));
      }

      drivingArray = sort(drivingArray);

      for (int i = 0; i < numBalls; i++) {

        balls[i] = new Ball(drivingArray[i], random(height), random(5, 55), random(75, 150), random(50, 200), random(100, 255), 255);
      }
    }

    void draw() 
    {
      background(0);

      stroke(200);
      line(0, 0, width, 0);
      line(0, height-1, width, height-1);

      for (int i = 0; i < numBalls; i++) {
        balls[i].connect(i);
        balls[i].display();
        balls[i].move();
      }
    }

    class Ball {
      float x, y, red, green, blue, alpha;
      float diameter;
      float dy = 0.63;
      float dx = 0.63;


      Ball(float temp_x, float temp_y, float temp_d, float temp_red, float temp_green, float temp_blue, float temp_alpha) {
        x = temp_x;
        y = temp_y;
        diameter = temp_d;
        red = temp_red;
        green = temp_green;
        blue = temp_blue;
        alpha = temp_alpha;
      } 


      void move() {
        y += dy * map(mouseY, 0, height, 0, 1);

        if (y + diameter/2 > height) {
          y = height - diameter/2;
          dy *= -1;
        } 
        else if (y - diameter/2 < 0) {
          y = diameter/2;
          dy *= -1;
        }

        x += dx * map(mouseX, 0, height, 0, 1);

        if (x + diameter/2 > width) {
          x = width - diameter/2;
          dx *= -1;
        } 
        else if (x - diameter/2 < 0) {
          x = diameter/2;
          dx *= -1;
        }
      }


      void connect(int i) {
        strokeWeight(1.5);
        stroke(255, 200);

        if (i == 0) {

          line(balls[i].x, balls[i].y, 0, height);
        }

        else if (i == numBalls-1) {

          line (balls[i].x, balls[i].y, width, height);
          line(balls[i].x, balls[i].y, balls[i-1].x, balls[i-1].y);
        }

        else if (i > 0) {
          line(balls[i-1].x, balls[i-1].y, balls[i].x, balls[i].y);
        }
      }

      void display() {
        fill(red, green, blue, alpha);

        if (y < height/2) {

          ellipse(x, y, diameter, diameter);
        }
        else if (y >= height/2) {
          rectMode(CENTER);
          rect(x, y, diameter, diameter);
        }
      }
    }

    Hi, just a clarification,

    when mouse is pressed mouseY reports values independently from window size? (but from actual screen size)

    Is it true? I cannot find anything in documentation but it seems this is how it works (actually a nice feature!)

    Thanks!
    Hi,

    I need to drive two lines contained in a class. I need some random shifting and I use noise(). If a call noise() and assign it to another variable it is moving the second line in parallel. 

    Probably pseydo-num generator is fixed within a class. Is there a way to overcome this? What are the suggestions from experienced programmers?

    Thank you
    Dimitris