HW Assignment #4 - 100115

Happy October!!!

Things that I did:

Click here to view my homework

Source Code:

var xpos=5;
var ypos=20;
var maybe=25;
var xspeed=10;
var yspeed=4;
var lineLength=20;
var moveIt = 0;
var right = 0;

function setup() {
createCanvas(800,600);
}

function draw() {
background(0);
stroke(255);

//line background
for (i=0; i<40; i++){
for (j=0; j<40; j++){
strokeWeight(random(2));
stroke(79,69,69);
line(xpos+(maybe*j), ypos*i, xpos+20+(maybe*j), (ypos*i)+20);
}
}
//rectangle background
for (k=0; k<8; k++){
noStroke();
fill(255,255,255,15);
rect (0,0,width/8*k, height/8*k);
}

//lightning
noStroke();
fill(255,254,239,random(75));
rect(0,0,800,600);

push();
scale(0.5);
translate(100+frameCount % 1000, 250);
cloudZ();
pop();

push();
scale(1);
translate(10+frameCount % 1000, height/2);
cloudZ();
pop();

push();
scale(1.5);
translate(100+frameCount % 1000, 350);
cloudZ();
pop();

push();
scale(1.5);
translate(200+frameCount % 1000, 100);
cloudZ();
pop();

push();
scale(1.5);
translate(-200+frameCount % 1000, 50);
cloudZ();
pop();

push();
scale(1);
translate(-35+frameCount % 1000, height/2);
cloudZ();
pop();

function cloudZ() {
noStroke();
fill(255,255,255);
rect(0,0,200,30);
rect(0,0,200,20);
rect(0-30,0+30,290,3);
rect(0-20,0+33,240,3);
rect(0-10,0+15,240,15);
ellipse(0+15,0+13,50,40);
ellipse(0+45,0-20,70,70);
ellipse(0+100,0-40,90,110);
ellipse(0+150,0-20,80,70);
ellipse(0+206,0+8,50,50);
}

}

View original source code