Live data from Hacker News

See what you can create with 140 characters of JavaScript and a canvas

dwitter.net

1–10 of 28 posts

Re: See what you can create with 140 characters of JavaScript and a canvas

#3
These all assume certain variables are pre-defined but nowhere does it say what they are.

Edit: If you hit "New dweet" it tells you.

u(t) is called 60 times per second.

t: Elapsed time in seconds.

S: Shorthand for Math.sin.

C: Shorthand for Math.cos.

T: Shorthand for Math.tan.

R: Function that generates rgba-strings, usage ex.: R(255, 255, 255, 0.5)

c: A 1920x1080 canvas.

x: A 2D context for that canvas.

Re: See what you can create with 140 characters of JavaScript and a canvas

#5
Well, I have done just about all I can to do to make the Matrix digital rain, but I am sadly 100 bytes over. I am out of time to kill, but if you aren't, please take this off of my hands. :)

  with(x)for(fillStyle="#000",fillRect(0,0,1e4,1e4),font="32px m",i=0;1920>i;i+=32)for(j=0,a=((2166136261*i^16777619)+960*t)%2160;b=255*(32>a-j),1080>j&&j

Re: See what you can create with 140 characters of JavaScript and a canvas

#6

These all assume certain variables are pre-defined but nowhere does it say what they are. Edit: If you hit "New dweet" it tells you. u(t) is called 60 times per second. t: Elapsed time in seconds. S: Shorthand for Math.sin. C: Shorthand for Math.cos. T: Shorthand for Math.tan. R: Function that generates rgba-strings, usage ex.: R(255, 255, 255, 0.5) c: A 1920x1080 canvas. x: A 2D context for that canvas.

I've always wished they'd have totally embraced their shortcuts and added as many as possible.

they could shorten every setter and function so c.width could just be w() or c.w= and c.fillStyle could just be fs(style) or c.fs=

They arbitrary shorten somethings but not others seems well... arbitrary

Re: See what you can create with 140 characters of JavaScript and a canvas

#8
post #5

Well, I have done just about all I can to do to make the Matrix digital rain, but I am sadly 100 bytes over. I am out of time to kill, but if you aren't, please take this off of my hands. :) with(x)for(fillStyle="#000",fillRect(0,0,1e4,1e4),font="32px m",i=0;1920>i;i+=32)for(j=0,a=((2166136261*i^16777619)+960*t)%2160;b=255*(32>a-j),1080>j&&j

[deleted]

Re: See what you can create with 140 characters of JavaScript and a canvas

#9
post #5

Well, I have done just about all I can to do to make the Matrix digital rain, but I am sadly 100 bytes over. I am out of time to kill, but if you aren't, please take this off of my hands. :) with(x)for(fillStyle="#000",fillRect(0,0,1e4,1e4),font="32px m",i=0;1920>i;i+=32)for(j=0,a=((2166136261*i^16777619)+960*t)%2160;b=255*(32>a-j),1080>j&&j

[deleted]

Re: See what you can create with 140 characters of JavaScript and a canvas

#10
post #5

Well, I have done just about all I can to do to make the Matrix digital rain, but I am sadly 100 bytes over. I am out of time to kill, but if you aren't, please take this off of my hands. :) with(x)for(fillStyle="#000",fillRect(0,0,1e4,1e4),font="32px m",i=0;1920>i;i+=32)for(j=0,a=((2166136261*i^16777619)+960*t)%2160;b=255*(32>a-j),1080>j&&j

174 it feels close. I dropped the text and went with numbers. (sorry for any duplicate notification spam)

   with(x)for(fillStyle="#000",font="2em m",fillRect(i=0,o=32,n=1920,n);n>i;i+=o)for(j=0,a=((2e7*i^1e9)+n*t)%n;n>j&&ja-j),n/2+j-a,b),fillText(j%9,i,j)
Post reply on HN