for(A="[c.@o@BanDntF12H99LatqMqh.~~cos(t/O*ON33RR)QH8_L)^256ZQN^)YY*_,Z-XerW0,V]=UBfyU'#);else ](;c@sn^/R00~sin()*~sign(t/),QN^VOLZfor(i~abs((x-yx+y)+~PI*kI.dqa.fill(fcVV5H,5H*_)gAU)x=i%Z-_,y=i/Z-_, t%14UH7*k+H7N;i<Z*Z||BpgI,V0);i+=Q*Ldan,-_,-_)I.dqa[i*4,Bfx'Greets to evWyone ovW q dwittW Dd jsgolf! ThDks PetW for orgDizing JS1K!',1~max(~min~max)-^n=documeF.creqeElemeF`cDvas`; in o=n.getCoFext`2d`)c[i[0]+i[6]Ui;I=c@cIZ,Zn.width=n.height=Zt=Vo.foF='4em sDs-sWif';setIFWval(A=>{if(++<250)=01 <*2&&(U+1U+2U%30<20?0:Zif(<5)=t%77 k=30-)>1Vv=xN-y*+yN+x*)+y/Q+x/20)+~hypot(x+LNRy+L*Q)/2030+v+110+v*2+213+v*3ZBrrfff'B0'Z-*2,2o.rotqe(~PI)0-*2,-56)rrc@gAU1))OROQN^O+ROXOOYOYRQN^-O-ORXYYOR^^-ROZ,Z+OL^)+^)},Q";G=/[-U-Z^_QRNO~qLHFDB@]/.exec(A);)with(A.split(G))A=join(shift());eval(A)
// https://github.com/prplz/js1k-2019
n = document.createElement`canvas`
o = n.getContext`2d`
I = c.createImageData(256, 256),
I.data.fill(n.width = n.height = 256),
t = 0,
o.font = '4em sans-serif'
setInterval(_ => {
if (++t % 1400 < 250)
for (i = 0; i < 256 * 256 || o.putImageData(I, 0, 0); i += 1)
x = i % 256 - 128,
y = i / 256 - 128,
// http://www.iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm
Math.max(Math.min(Math.abs(x - y), Math.abs(x + y)), Math.max(Math.abs(x - y), Math.abs(x + y)) - 99) < t % 1400 * 2 && (I.data[i * 4] = I.data[i * 4 + 1] = I.data[i * 4 + 2] = Math.max(Math.min(Math.abs(x - y), Math.abs(x + y)), Math.max(Math.abs(x - y), Math.abs(x + y)) - 99) % 30 < 20 ? 0 : 256)
else if (t % 1400 < 500)
for (i = t % 7; i < 256 * 256 || o.putImageData(I, 0, 0); i += 7)
x = i % 256 - 128,
y = i / 256 - 128,
k = Math.abs(30 - Math.max(Math.min(Math.abs(x - y), Math.abs(x + y)), Math.max(Math.abs(x - y), Math.abs(x + y)) - 99)) > 10,
v = Math.sin(x * Math.cos(t / 99) / 33 - y * Math.sin(t / 99) / 33 + y * Math.cos(t / 99) / 33 + x * Math.sin(t / 99) / 33)
+ Math.sin(y / 33)
+ Math.sin(x / 20)
+ Math.sin(Math.hypot(x + 99 * Math.cos(t / 33), y + 99 * Math.sin(t / 33)) / 20),
I.data[i * 4] = 127 * k + 127 * Math.cos(t / 30 + v + Math.PI * k),
I.data[i * 4 + 1] = 127 * k + 127 * Math.cos(t / 10 + v * 2 + Math.PI * k),
I.data[i * 4 + 2] = 127 * k + 127 * Math.cos(t / 13 + v * 3 + Math.PI * k)
else
I.data.fill(256),
o.resetTransform(o.fillStyle = '#fff'),
o.fillRect(0, 0, 512, 512),
o.fillStyle = '#000',
o.fillText('Greets to everyone over at dwitter and jsgolf! Thanks Peter for organizing JS1K!', 1256 - t % 1400 * 2, 200),
o.rotate(Math.PI),
o.fillText('Greets to everyone over at dwitter and jsgolf! Thanks Peter for organizing JS1K!', 1000 - t % 1400 * 2, -56)
c.resetTransform(c.globalAlpha = 1)
c.fillRect(0, 0, 512, 512)
// front/back
c.setTransform(
Math.cos(t / 33 /*yaw*/) * Math.sign(Math.cos(t / 33 /*yaw*/) * Math.cos(t / 99 /*pitch*/)),
Math.sin(t / 33 /*yaw*/) * Math.sin(t / 99 /*pitch*/) * Math.sign(Math.cos(t / 33 /*yaw*/) * Math.cos(t / 99 /*pitch*/)),
0,
Math.cos(t / 99 /*pitch*/),
256 + Math.sin(t / 33 /*yaw*/) * Math.sign(Math.cos(t / 33 /*yaw*/) * Math.cos(t / 99 /*pitch*/)) * 128,
256 - Math.cos(t / 33 /*yaw*/) * Math.sin(t / 99 /*pitch*/) * Math.sign(Math.cos(t / 33 /*yaw*/) * Math.cos(t / 99 /*pitch*/)) * 128)
c.globalAlpha = Math.abs(Math.cos(t / 33 /*yaw*/) * Math.cos(t / 99 /*pitch*/))
c.drawImage(n, -128, -128)
// left/right
c.setTransform(
Math.sin(t / 33 /*yaw*/) * Math.sign(Math.sin(t / 33 /*yaw*/) * Math.cos(t / 99 /*pitch*/)),
-Math.cos(t / 33 /*yaw*/) * Math.sin(t / 99 /*pitch*/) * Math.sign(Math.sin(t / 33 /*yaw*/) * Math.cos(t / 99 /*pitch*/)),
0,
Math.cos(t / 99 /*pitch*/),
256 - Math.cos(t / 33 /*yaw*/) * Math.sign(Math.sin(t / 33 /*yaw*/) * Math.cos(t / 99 /*pitch*/)) * 128,
256 - Math.sin(t / 33 /*yaw*/) * Math.sin(t / 99 /*pitch*/) * Math.sign(Math.sin(t / 33 /*yaw*/) * Math.cos(t / 99 /*pitch*/)) * 128)
c.globalAlpha = Math.abs(Math.sin(t / 33 /*yaw*/) * Math.cos(t / 99 /*pitch*/))
c.drawImage(n, -128, -128)
// top/bottom
c.setTransform(
Math.cos(t / 33 /*yaw*/) * Math.sign(Math.sin(t / 99 /*pitch*/)),
Math.sin(t / 33 /*yaw*/) * Math.sin(t / 99 /*pitch*/) * Math.sign(Math.sin(t / 99 /*pitch*/)),
-Math.sin(t / 33 /*yaw*/),
Math.cos(t / 33 /*yaw*/) * Math.sin(t / 99 /*pitch*/),
256,
256 + Math.cos(t / 99 /*pitch*/) * Math.sign(Math.sin(t / 99 /*pitch*/)) * 128)
c.globalAlpha = + Math.abs(Math.sin(t / 99 /*pitch*/))
c.drawImage(n, -128, -128)
}, 33)