xxxxxxxxxx
function setup() {
createCanvas(600, 400);
background(100);
}
// sw is short for stroke weight
let sw1 =3
let sw2 =2
let sw3 =1
function draw() {
fill('#fae');
rect(0,0,600,400);
//this for loop draws the blue lines all over the canvas
//height at random y values with a specified stroke weight
//the same loop is repeatdly used to draw other lines with
//diff colours & stroke weights in diff specified areas on the canvas
//the use of random() is to minimize the amount of code i write
//but also allows for different visuals with each iteration of the program
for (var i = 0; i < 100; i++) {
var y = random(height);
//line(x, y, 600, x);
//line(x, y, 600, y);
stroke('blue');
strokeWeight(sw1);
line(0, y, 600, y);
noLoop();
}
for (var i = 0; i < 90; i++) {
var y = random(0,200);
stroke('red');
strokeWeight(sw2);
line(0, y, 600, y);
noLoop();
}
for (var i = 0; i < 50; i++) {
var y = random(100,250);
stroke('rgb(164,16,235)');
strokeWeight(sw3);
line(0, y, 600, y);
noLoop();
}
for (var i = 0; i < 30; i++) {
var y = random(200,height);
stroke('rgb(245,196,61)');
strokeWeight(sw2);
line(0, y, 600, y);
noLoop();
}
for (var i = 0; i < 100; i++) {
var y = random(0,height);
stroke('rgb(176,8,128)');
strokeWeight(sw3);
line(0, y, 600, y);
noLoop();
}
for (var i = 0; i < 90; i++) {
var y = random(0,height);
stroke('rgb(48,194,104)');
strokeWeight(sw1);
var x = random(0,500)
line(x, y, x+70, y);
noLoop();
}
for (var i = 0; i < 90; i++) {
var y = random(0,height);
stroke('rgb(255,32,161)');
strokeWeight(sw2);
var x = random(0,500)
line(x, y, x+100, y);
noLoop();
}
}