top of page
megansigler

P5 Sketch 2

Updated: Nov 2, 2023

For my second P5 sketch, I utilized the mouseIsPressed and keyIsPressed functions to make my artwork interactive. Below are the images that I created along with the code.




function setup() {

createCanvas(1280, 720);

}


function draw() {

background(120,240,80);

if(mouseIsPressed){

strokeWeight(0);

} else{

strokeWeight(4);

}

stroke(0);

for (let y=0; y<=height; y+=40)

{for (let x=0; x<=width; x+=40)

{

fill(250,160,240);

ellipse(x,y,40,40);

}}

strokeWeight(55);

if (keyIsPressed) {

stroke(120,240,80);

} else{

stroke(0);

}

line(0,400,width,0);

line(0,0,400,height);

}

3 views0 comments

Recent Posts

See All

Comments


  • Facebook
  • Instagram
bottom of page