xxxxxxxxxx
function setup() {
createCanvas(windowWidth, windowHeight);
background(220);
}
const connectedCubeArray = [];
function draw() {}
function keyPressed() {
const cubeP = connectedCubeArray[0];
const cube1 = connectedCubeArray[1];
if (keyCode === 32 /* Space Key */ ) {
cubeP?.moveTo({
x: P5tId.RingMat.startPointGreenSideX,
y: P5tId.RingMat.startPointGreenSideY,
angle: -Math.PI / 2,
angleType: 0
}, 80);
cube1?.moveTo({
x: P5tId.RingMat.startPointBlueSideX,
y: P5tId.RingMat.startPointBlueSideY,
angle: Math.PI / 2,
angleType: 0
}, 80);
}
}
function mouseClicked() {
P5tCube.connectNewP5tCube().then(cube => {
connectedCubeArray.push(cube);
cube?.turnLightOn('white');
});
}