20 lines
504 B
JavaScript
20 lines
504 B
JavaScript
// Sketch 1.1: Mouse Events!
|
|
|
|
function setup() {
|
|
createCanvas(800, 800);
|
|
}
|
|
|
|
function draw() {
|
|
// background("yellow");
|
|
if(mouseIsPressed) {
|
|
print("Pressed: " + mouseX + " - " + mouseY) ; // see the console below ↓
|
|
background("yellow"); // 2
|
|
}
|
|
}
|
|
|
|
function mouseMoved() {
|
|
print("Moved: " + mouseX + " - " + mouseY) ; // see the console below ↓
|
|
circle(mouseX, mouseY, 10);
|
|
}
|
|
|
|
// Reference: https://p5js.org/reference/
|