Click to connect Cube then put it on the Mat.
A fork of p5.toio Sample : Play MIDI melody by tetunori
xxxxxxxxxx
function setup() {
createCanvas(windowWidth, windowHeight);
background(220);
}
const connectedCubeArray = [];
function draw() {
// Keep on gazing at mouse point
for( const cube of connectedCubeArray ){
const x = Math.floor(mouseX * 300 / windowWidth + 200);
const y = 144;
const spd = 115;
cube?.turnToXY( x, y, spd );
}
}
function mouseClicked() {
P5tCube.connectNewP5tCube().then( cube => {
connectedCubeArray.push( cube );
} );
}