by ryeguy_24 on 12/25/24, 1:07 AM with 44 comments
by ryeguy_24 on 12/25/24, 1:07 AM
by jll29 on 12/25/24, 11:22 AM
In the spirit of minimalism, Merry Christmas to all HNers with this little but time-tested command:
$ xmastree 5 9 2024`
*
***
*****
*******
*
***
*****
*******
*
***
*****
*******
*
***
*****
*******
***
***
***
***
Source: https://github.com/jochenleidner/ltools/blob/main/src/bin/xm...by Lerc on 12/25/24, 9:42 AM
function u(t) {
t||(c.width/=6) // shrink canvas to 1/6 at t==0
M=a=>x.filter=a?"none":"blur(1px)brightness(90%"
M();x.drawImage(c,0,0)
for(i=n=90;--i;)
x.fillRect(
160-S(X=i+t*4)*(1-(v=C(i*n))*v)*n,
v*n+n,
4,
2,
x.fillStyle="#F"+(i+10),M(C(X)<0))
}
with
u(t) is called 60 times per second.
t: elapsed time in seconds.
c: A 1920x1080 canvas.
x: A 2D context for that canvas.
S: Math.sin
C: Math.cosby foobar1962 on 12/25/24, 11:08 AM
by leeoniya on 12/25/24, 3:48 AM
by theodpHN on 12/25/24, 8:23 AM
by belter on 12/25/24, 2:03 PM
by bazzargh on 12/25/24, 1:40 PM
by noduerme on 12/25/24, 10:40 AM
by theodpHN on 12/25/24, 8:31 AM
by theodpHN on 12/25/24, 8:20 AM
by Alifatisk on 12/25/24, 11:12 AM
by BobbyTables2 on 12/25/24, 4:53 AM
by layer8 on 12/25/24, 3:03 AM