xxxxxxxxxx
25
function setup() {
noCanvas();
let body = select('body');
body.style('perspective', '1000px');
let leftX = windowWidth * 0.1;
let topY = windowHeight * 0.1;
let n = 11;
let spacingX = (windowWidth * 0.8) / n;
let spacingY = (windowHeight * 0.8) / n;
for (let i = 0; i < n; i++) {
for (let j = 0; j < n; j++) {
let d = createDiv('rotate');
d.position(leftX + i*spacingX, topY + j*spacingY);
d.style('font-size', '48px');
let yRotation = (i*180/(n-1));
let xRotation = -90 + (j*(180/(n-1)));
d.style('transform',
'translateZ(-50px)' + // so rotateX doesn't clip
'rotateY('+yRotation+'deg) ' +
'rotateX('+xRotation+'deg)');
}
}
}