[p5] mousePressed

ChenΒ·2024λ…„ 6μ›” 19일
0

p5.js

λͺ©λ‘ 보기
3/5

mouseIsPressed => 번쩍번쩍

function setup() {
    createCanvas(windowWidth, windowHeight);
    background(220);
}

function draw() {
    console.log(mouseIsPressed); // true, false
    if (mouseIsPressed) {
        background(random(255), random(255), random(255));
    }

    circle(mouseX + random(-10, 10), mouseY + random(-10, 10), random(50));
}


mousePressed => 깔끔 no 번쩍

function setup() {
    createCanvas(windowWidth, windowHeight);
    background(220);
}

function draw() {
    //if (mouseIsPressed) {
    //    background(random(255), random(255), random(255));
    //}

    circle(mouseX + random(-10, 10), mouseY + random(-10, 10), random(50));
}

function mousePressed() {
    background(random(255), random(255), random(255));
}

profile
ν˜„μ‹€μ μΈ λͺ½μƒκ°€

0개의 λŒ“κΈ€