The video appears to be playing as I am getting the sound when I run the sketch but no picture, I thought it might be the background but changing it with a trial and error approach has no effect. Any ideas?
- import processing.video.*;
- Movie myMovie;
- int passedTime;
- int savedTime;
- int totalTime = 10000;
- int rainNum = 100;
- ArrayList rain = new ArrayList();
- ArrayList splash = new ArrayList();
- float current;
- float reseed = random(0, .2);
- void setup()
- {
- myMovie = new Movie(this, "lightning3.mov");
- size(600, 600, P3D);
- colorMode(HSB, 100);
- background(0);
- rain.add(new Rain());
- current = millis();
- }
- void draw()
- {
- savedTime = millis();
- // background (0);
- if (passedTime < totalTime) {
- myMovie.loop();
- image(myMovie,0,0);
- delay (25);
- }
- else {
- strokeWeight(9);
- stroke(255, 2, 2);
- line (width/2.0, 0, 100,
- width/2.0, 0, 200 );
- if ((millis()-current)/1>reseed &&
- rain.size()<150)
- {
- rain.add(new Rain());
- float reseed = random(0, .2);
- current = millis();
- }
- for (int i=0 ; i<rain.size() ; i++)
- {
- Rain rainT = (Rain) rain.get(i);
- rainT.calculate();
- rainT.draw();
- if (rainT.position.y>height)
- {
- for (int k = 0 ; k<random(5,10) ; k++)
- {
- splash.add(new Splash(rainT.position.x, height, rainT.position.z));
- }
- rain.remove(i);
- float rand = random(0, 100);
- if (rand>10&&rain.size()<150)
- rain.add(new Rain());
- }
- }
- for (int i=0 ; i<splash.size() ; i++)
- {
- Splash spl = (Splash) splash.get(i);
- spl.calculate();
- spl.draw();
- if (spl.position.y>height)
- splash.remove(i);
- }
- }
- }
- // ==========================================
- public class Rain
- {
- PVector position, pposition, speed;
- float col;
- public Rain()
- {
- position = new PVector(random(0, width), -500, random(0, 800));
- pposition = position;
- speed = new PVector(0, 0);
- col = random(30, 100);
- }
- void draw()
- {
- stroke(100, col);
- strokeWeight(2);
- line(position.x, position.y, position.z, pposition.x, pposition.y, position.z);
- //ellipse(position.x,position.y,5,5);
- }
- void calculate()
- {
- pposition = new PVector(position.x, position.y);
- gravity();
- }
- void gravity()
- {
- speed.y += .2;
- speed.x += .01;
- position.add(speed);
- }
- }
- public class Splash
- {
- PVector position, speed;
- public Splash(float x, float y, float z)
- {
- float angle = random(PI, TWO_PI);
- float distance = random(1, 5);
- float xx = cos(angle)*distance;
- float yy = sin(angle)*distance;
- position = new PVector(x, y, z);
- speed = new PVector(xx, yy);
- }
- public void draw()
- {
- strokeWeight(1);
- stroke(100, 50);
- fill(100, 100);
- // ellipse(position.x, position.y, 2, 2 );
- point(position.x, position.y, position.z );
- }
- void calculate()
- {
- gravity();
- speed.x*=0.98;
- speed.y*=0.98;
- position.add(speed);
- }
- void gravity()
- {
- speed.y+=.2;
- }
- }