xxxxxxxxxx
let f=0;
function setup() {
createCanvas(400, 400, WEBGL);
stroke(255);
}
function draw() {
background(0);
lights();
rotateX(-0.3);
[-50,50].map(i=>{
fill(255);
push();
translate(i,i,i);
[f,f+50].map(a=>{
F=a%100;
push();
let V=F-50;
translate(V,V,V);
box((F<50?F:100-F)*2);
pop()
});
pop();
});
noFill();
push();
let M=(2*f)%100-50;
translate(M,M,M);
pop(box(100))
f+=0.7;
}
/* ----------------------------------------
The shortest code I can write is this:
---------------------------------------- */
// f=0
// draw=_=>{
// f||createCanvas(W=400,W,WEBGL)
// T=translate
// background(0)
// rotateX(-.3)
// lights(stroke(W))
// push(noFill([-50,50].map(i=>(push(fill(W)),T(i,i,i),pop([f,f+50].map(a=>(push(F=a%100),T(V=F-50,V,V),pop(box((F<50?F:100-F)*2)))))))))
// T(M=(2*f)%100-50,M,M)
// pop(box(100))
// f+=.7
// }
/* Minimized (298 characters) */
// f=0,draw=p=>{f||createCanvas(W=400,W,WEBGL),T=translate,background(0),rotateX(-.3),lights(stroke(W)),push(noFill([-50,50].map(p=>(push(fill(W)),T(p,p,p),pop([f,f+50].map(p=>(push(F=p%100),T(V=F-50,V,V),pop(box(2*(F<50?F:100-F)))))))))),T(M=2*f%100-50,M,M),pop(box(100)),f+=.7};//#つぶやきProcessing
/* ! Tell me if you manage to fit it into 280 characters and I'll buy you a beer, or vine, ... or protein drink */