Live data from Hacker News

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

dwitter.net

11–20 of 28 posts

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

#11
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

This is how far I got starting from yours. I've no idea how the code works I just kept bashing on it.

https://www.dwitter.net/d/10354

Edit:

Here is a much nicer version with white droplets. I think I'm done for today

https://www.dwitter.net/d/10356

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

#13

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

You know, the 140 chars limit or even the fact that there should be a limit at all is arbitrary too :)

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

#15

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

Hmm, a Short JS or Golfed JS standard should be ratified.

Like jQuery.

"But that's cheating!", people will say. I disagree; JS is verbose, but it's so widespread that if we can shorten it will result in new levels of compact creativity that we are missing out on. And JS is so full of frameworks, something like this wouldn't set that much precedent.

Post reply on HN