JSFiddle - React, Tailwind, and code Playground
JavaScript
(function Q(n){
X=(D=document).body.appendChild(C=D.createElement('Canvas')).getContext('2d');
C.width=C.height=600;
M=Math; //saves 24 chars
T=[[275,400,50,i=0]]; //T is for (invisible) triangles
while(A=T[i++]){ //iterate until we run out
X.save(); //in JS we can't draw slanted squares without...
X.translate(x=A[0],y=A[1]); // translating
X.rotate(-(a=A[3])); //then rotating
X.fillRect(0,-(l=A[2]),l,l); //then drawing
X.restore(); //then restoring... sigh.
S=M.sin;
C=M.cos;
i<M.pow(2,n)&&T.push([ //if we've done enough, stop adding triangles
e=x-l*S(a), //these
f=y-l*C(a), //lines
g=l*C(b=M.random()*M.PI/2), //took
d=a+b //many
],[
e+g*C(d), //hours
f-g*S(d), //of
l*S(b), //scribbled
d-M.PI/2 //diagrams
])
}
}(10))