xxxxxxxxxx
131
function setup() {
createCanvas(400, 400);
background(240, 231, 201);
//noLoop();
}
function draw() {
//var runtime=1;
//console.log('looping?');
blendMode(BLEND);
//wall & canvas
noStroke();
fill(116, 128, 130);
rect(0,0,25,400);//leftwall
rect(375,0,25,400);//rightwall
rect(0,0,400,75);//topwall
rect(0,275,400,125);//bottomwall
//light
fill(255);
rect(125,25,150,5,5);//light
fill(60);
rect(122,22.5,156,4);//lightbar
//rect(197.5,10,5,15);
rect(130,10,5,15,2);//left arm
rect(265,10,5,15,2);//right arm
//name card
fill(225);
rect(345,285,30,10);
/*if (runtime < 1) {
fill(0);
ellipse(200,200,100,100);
}*/
//ropes
push();
noFill();
//left rope
strokeWeight(7.5);
stroke(171, 5, 5);
arc(32,330,125,40,0,PI);
//right rope
arc(380,330,125,40,0,PI);
pop();
//pole one
rect(100,320,12,100,5);
circle(106,313,15);
//ring pole one
push();
fill(255);
circle(110,310,5);//highlight
rect(91,325,30,5,5);//ring
pop();
//pole two
rect(300,320,12,100,5);
circle(306,313,15);
//ring pole two
push();
fill(255);
circle(310,310,5);//highlight
rect(291,325,30,5,5);//ring
pop();
//arc(50,200,350,200,PI,0);
//frameRate(10);
//outline of canvas
strokeWeight(2);
stroke(200);
line(23,74,377,74);//top
stroke(25);
line(23,275,377,275);//bottom
stroke(100);
line(377,75,377,275);//rightside
stroke(80);
line(23,75,23,275);//leftside
//instructions
noStroke();
textSize(18);
fill(255);
//text
text("add a random stroke by clicking",78,60);
text("press 's' to save your painting",90,295);
}
function mousePressed(){
//randomness begins
let r= random(0,255);
let g= random(0,255);
let b= random(0,255);
//random points
point1=random(30,370);//x
point2=random(80,270);//y
point3=random(30,370);//x
point4=random(80,270);//y
point5=random(30,370);//x
point6=random(80,270);//y
point7=random(30,370);//x
point8=random(80,270);//y
xpos= random(0,400);
ypos= random(0,400);
//end randomness
noStroke();
stroke(r,g,b);
strokeWeight(12.5);
noFill();
//fill(r,g,b);
bezier(point1,point2,point3,point4,point5,point6,point7,point8);
// console.log('working');
}
function keyPressed(){
if(key=='s'){
saveCanvas('pollockPainting','png');
}
}