_="r@rotGe(x*.0174`n@var i=I[x];0&&t<220jbegPGhmovZ0lZm*m*NB+}1Fy>=O2]?,0+):+NQB}2FU-U+O2]N}`p@6JUi*60n(0}`d@I=[];15Jx=R$i<2j$%3V,60+52)2)K20}%K%6V53)%7V,180+54)8)i>=1-66)Q}clearRect( .5* /2_0X_5X15.47+2)252225.32Q)`m^m( )/600;b.appendChild(A=document.creGeElement('put')position='absoluteH|ntSize='3emHcborderC'#9ffHleft=top=paddg='15pxHb.sD.A.|cusL=setInterval({q=A.value.toLowerCaseif (q!=L) {h=0;|Ui q)h=((h<<-h)+q.charCodeAt(iR=(Y-1&(h^imul(48271,h)))/Y;dL=q;}},200,~~(restore(xNB)=>A.sD.I.push([);+O3]NR()* a.width,a.height$i&&O0]==backgroundC'#000Helse $saveSD='rgba()Hp(leWidth=m*(n(xQO1],40+c.,zQ,ttranslGe(|Ui=0;i<0,olor=(stroke5)in]$if(%x<.@={B,z,tDtyleF&&z<6jGatH';J;i++jK010N,yOi[Q+1Ur(V)2X0)+',Y2**31ZeTo(^=MGh._'+(1`};j){|fo5,";for(Y in $="|j`_^ZYXVUQONKJHGFDB@%$ ")with(_.split($[Y]))_=join(pop());eval(_)
//rotate by x degrees (x ~= pi/180)
r=(x,y,z,t)=>{c.rotate(x*.01745)};
//instruction loop (x - cursor position, y - jump counter, z - branch counter, t - line length counter)
n=(x,y,z,t)=>{
var i=I[x];
if(i&&i[0]==0&&t<220){ //go forward (i[1] distance)
c.beginPath();
c.moveTo(0,0);
c.lineTo(0,m*i[1]);
c.translate(0,m*i[1]);
c.stroke();
n(x+1,y,z,t+i[1]);
}
if(i&&i[0]==1&&z<6){ //jump back (i[1] number of instructions, i[2] max number of jumps)
y>=i[2]?n(x+1,0,z+1,t+i[1]):n(x+1+i[1],y+1,z,t);
}
if(i&&i[0]==2&&z<6){ //branch (i[1] angle, i[2] jump forward instruction count for main branch, i[3] jump forward instruction count for side branches)
c.save();
r(-i[1]);
n(x+1+i[3],y,z+1,t);
c.restore();
c.save();
r(i[1]);
n(x+1+i[3],y,z+1,t);
c.restore();
c.save();
n(x+1+i[2],y,z+1,t);
c.restore();
}
};
//draw snowflake shape after setting style (called twice)
p=(x,y,z,t)=>{
for(i=0;i<6;i++){
c.save();
r(i*60);
n(0,0,0,0);
c.restore();
}};
//generate instructions, set style and draw
d=(x,y,z,t)=>{
I=[];
for(i=0;i<15;i++){
x=R();
if(i<2){
if(x<.3)I.push([2,R()*60+5,~~(R()*2),~~(R()*2)]);
I.push([0,R()*40+10]);
I.push([2,R()*40+5,0,~~(R()*5)]);
}
else if(x<.5)I.push([0,R()*40+10]);
else if(x<.6)I.push([2,R()*40+5,~~(R()*3),~~(R()*5)]);
else if(x<.7)I.push([2,R()*180+5,~~(R()*4),~~(R()*8)]);
else if(i>=5)I.push([1,~~(R()*5)-6,~~(R()*6)+1]);
}
c.clearRect(0,0,a.width,a.height);
c.save();
c.translate(.5*a.width,a.height/2);
c.strokeStyle='rgba('+(R()*100)+','+(R()*150)+',150,.4)';
p(c.lineWidth=m*(R()*7+2)); //darker and wider lines first
c.strokeStyle='rgba(255,225,255,.3)';
p(c.lineWidth=m*(R()*2+1)); //then lighter and thiner on top of them
c.restore();
};
m=Math.min(a.width,a.height)/600;
b.appendChild(A=document.createElement('input'));
A.style.position='absolute';
A.style.fontSize='3em';
A.style.backgroundColor='#000';
A.style.color=A.style.borderColor='#9ff';
A.style.left=A.style.top=A.style.padding='15px';
b.style.backgroundColor='#000';
A.focus();
L=setInterval((x,y,z,t)=>{ //check name changes every 200ms
q=A.value.toLowerCase();
if (q!=L) {
h=0;
for(i in q)h=((h<<5)-h)+q.charCodeAt(i); //get numeric hash from name
R=(x,y,z,t)=>(2**31-1&(h=Math.imul(48271,h)))/2**31; //use name hash as seed - like random, but same name always gives same result
d();
L=q;
}
},200);