xxxxxxxxxx
32
function setup() {
createCanvas(windowWidth, windowHeight);
}
function draw() {
background(220);
}
function mouseClicked() {
マウスがクリックされたら();
}
const キューブと接続する = () => {
return new Promise((resolve) => {
P5tCube.connectNewP5tCube()
.then((cube) => {
resolve(cube);
})
});
}
const 白色 = 'white';
const ランプを点灯 = (キューブ, 色) => {
キューブ.turnLightOn(色);
}
const マウスがクリックされたら = () => {
キューブと接続する().then(キューブ => {
ランプを点灯(キューブ, 白色);
});
}