mirror of
https://github.com/Cametendo/EMVs-Creative-coding.git
synced 2026-06-20 17:45:02 +02:00
Added interactivity
This commit is contained in:
24
sketch.js
24
sketch.js
@@ -3,15 +3,23 @@ let r, g, b = 0;
|
|||||||
function setup() {
|
function setup() {
|
||||||
createCanvas(800, 800);
|
createCanvas(800, 800);
|
||||||
strokeWeight(5);
|
strokeWeight(5);
|
||||||
frameRate(5)
|
|
||||||
background(100, 100, 100, 1);
|
|
||||||
for(i = 0; i < 10; i++) {
|
|
||||||
stroke(random(255), random(255), random(255))
|
|
||||||
noFill()
|
|
||||||
square(random(width), random(height), random(300));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function draw() {
|
function draw() {
|
||||||
frameRate(5);
|
frameRate()
|
||||||
|
background(100, 100, 100, 100);
|
||||||
|
for(i = 0; i < 1; i++) {
|
||||||
|
stroke(random(255), random(255), random(255))
|
||||||
|
noFill()
|
||||||
|
const rectWidth = random(300);
|
||||||
|
const rectHeight = random(300);
|
||||||
|
const rectMidX = (width/2) - (rectWidth/2);
|
||||||
|
const rectMidY = (height/2) - (rectHeight/2);
|
||||||
|
const offsetX = random(-40, 40);
|
||||||
|
const offsetY = random(-40, 40);
|
||||||
|
rect(rectMidX + offsetX, rectMidY + offsetY, rectWidth, rectHeight);
|
||||||
|
rect(mouseX + offsetX, mouseY + offsetY, rectWidth, rectHeight);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user