Random x placement and proportional scaling

Hello Processors, thank you for your time. I am trying to place video-objects along the same y height but random x position, it works but it moves non stop. Also I am trying to scale, proportionally the object using the scale function unsuccessfully. Please take a look at my code, thank you.

import processing.video.*;
Movie myMovie;

int numVideos = 10;
Video[] videos = new Video[numVideos];

float groundY = 580;

void setup() {
  size (640, 640);
  myMovie = new Movie(this, "fogata.mp4");
  myMovie.loop();
  for (int i = 0; i < numVideos; i++) {
    videos[i] = new Video(4096/10, 2160/10);
  }
}

void draw() {
  background(64);
  stroke(255);
  line(0, groundY, width, groundY);
  for (Video video : videos) {
    //Video.move();
    video.display();
  }
}

void movieEvent(Movie m) {
  m.read();
}
class Video {

  float rectX, rectY, rectW, rectH;
  float rectSpeedX, rectSpeedY;
  float y = 0;


  Video (float w, float h) {
    rectW = w;
    rectH = h;
  }

  void display() {
    for (float i = 0; i<0; i++) {
      scale(-5*i);
    }
   image(myMovie, random(5)*50, y, rectW, rectH);
  }
}
1 Like

What is this for loop doing?

Anyway, think about this line:

image(myMovie, random(5)*50, y, rectW, rectH);

You’re setting a random position every time your draw it. It sounds like you want to come up with a random position once, then store it in a variable at creation time?

1 Like

the loop is scaling all the images at the same time, that is not what i want. I want random scaling

I change it so that a global variable hold a random(1); but the changes are to drastic.

Are you sure? Have you tried adding a println() statement inside the loop to confirm your assumptions?

Can you please be more specific? What do you mean by global variable? What do you mean by drastic?

Sorry , yes, for scale i made a global variable s= random(1.5); I can see now that it works. Thank you