top of page
  • awebste11

p5.js sketch 2

Sketched after day 2 of learning to code through p5.js

I experimented with color and tested out the Adobe color site talked about in class, in order to build a color palette.

I positioned different rectangles on the page, Increasing the x & y values by 40 to shift them down diagonally across the canvas.

At the end I tested out both the mouse "drawing" tool (I used it more as a cursor mark) and then applied the 'if mouse is pressed' function to darken the mouse ellipse when it's clicked.






Code:

function setup() {

createCanvas(1280, 720);

}

function draw() {

background(250,67,102,);

noStroke()

fill(104,70,250);

rect(40,40,1240,680);

fill(211,67,250);

rect(80,80,1200,640);

fill(250,67,211);

rect(120,120,1160,600);

fill(151,67,250);

rect(160,160,1120,560);

fill(73,67,280);

rect(200,200,1080,520);


fill(55,250,270);

rect(240,240,1040,480);

fill(13,191,249);

rect(280,280,1000,440);

fill(12,116,250);

rect(320,320,960,400);

fill(55,160,335);

rect(360,360,920,360);


fill(68,250,169);

rect(400,400,880,320);

fill(250,230,12);

rect(440,440,840,280);

fill(250,147,87);

rect(480,480,800,240);


fill(250,100,42);

rect(520,520,760,200);

fill(250,45,12);

rect(560,560,720,160);


fill(250,12,187);

rect(600,600,680,120);

fill(183,0,250);

rect(640,640,640,80);

fill(84,11,251);

rect(680,680,600,40);

if (mouseIsPressed == true)

fill(0);

ellipse( mouseX, mouseY, 40,40);

}


3 views0 comments

Recent Posts

See All

Comments


478E7F1F-E7A2-4A33-AFF6-92194C4CE2FD.jpeg
bottom of page