

Wub - Cool Javascript effect - nickb
http://www.rolyn.co.uk/wub.htm

======
old-gregg
This is so awesome that we get to reimplement the same graphics effects we did
on first PCs from the mid 80s, but this time - fully loading CPUs on machines
that would have been cosidered supercomputers back then!

It's called progress. And because of it, we programmers will never be out of
work.

~~~
gruseom
Although you seem to mostly be talking about new platforms, I'd add another
reason for this perpetual reimplementation: the amazing lack of knowledge
transfer from one generation of programmers to the next. Nearly everybody
seems to start from scratch, and of course we all think our ideas and programs
are original and far superior to what came earlier.

I've often wondered about this. Part of it may be that the real practice of
programming is totally divorced from the schools that (supposedly) teach it.
Another part is obviously that the quick succession of languages and platforms
reduces earlier work to the equivalent of ancient indecipherable tablets (if
it's even available). On that last point, one of the unexpected pleasures of
working in Common Lisp is being able to easily read 20-year old code. It turns
out they weren't as stupid back then as we might think!

~~~
albertcardona
Great point about the "undecipherable tables" that any program eventually
becomes as languages, platforms and OSes change.

Beyond PR and vested interests, the full backward compatilibity of java (even
when it hurts) and of Windows (up to XP) account for their survival a lot more
than anyone would ever suspect at first thought.

------
axod
This bit is quite funny: Function to work out approximate width of a word
based on Arial font letter widths.

Probably possible to do by putting the word in an offscreen div with style set
so it's only as wide as content, then checking the size of the div...

    
    
      function fontWidth(word){
      // arial font
      var S = "a68b68c68d68e68f31g68h68i31j31k68l31m108\
                     n68o68p68q68r39s68t39u68v50w90x68y68z68A\
                     90B90C90D90E90F78G98H90I28J59K90L68M108N\
                     90O98P90Q98R90S90T68U90V90W130X68Y90Z68'\
                     30.42!29?68-41/41=72";
        var l = word.length;
        var s = 0;
        var x = 0;
        var c = 0;
        for(i=0;i<l;i++){
    		c = word.charAt(i);
    		x = S.indexOf(c);
    		if(c>="0" && c<="9")s+=69;
      	else 
        if(x>=0)s+=parseInt(S.substring(x+1,x+4));
    		else s+=68;
    	}
    	return s/10;
      }

~~~
andreyf
Why not just do it with an object of letter -> width key/pairs? then...

    
    
        fontWidth(word) {
            return sum(map(word.split(''), function (l) letterWidth[l]));
        }
    

I bet it would be faster in firefox.

------
btw0
Have you guys checked out <http://monstropolis.org>, I think it's from the
same guy.

EDIT: I found more: <http://monstropolis.org/intro>[1-11].html, replace [1-11]
with any number between 1 and 11.

------
zzzmarcus
It's funny, now that Javascript interpreters are getting fast and decent
effects can be written in Javascript you start seeing lots pages like this.

I say it's funny because it reminds me of the explosion of similar animations
that were created in Flash a few years around the time that Flash 5 and 6 came
out. Animations that were mostly cool and revolutionary-seeming because of the
technology rather than the actual content.

I'm not knocking this type of creation--I was really fun time to be working in
Flash with so many 'breakthroughs.' Now it's cool to see a similar surge in
creativity happening in a language that is even more ubiquitous than
ActionScript.

~~~
gb
My thoughts exactly, I was also involved in Flash experiments from the days of
Flash 4 even, when it was horrendous to "code" in.

I can't help but find it slightly irritating when people remake these in
Javascript these days to have praise heaped upon them for interesting new
experiments. ;)

------
MoeDrippins
it. made. my. machine. very. slow.

Interesting, I guess. What purpose though other than "neat"? I'm trying to
come up with a UI need it would fulfill, but can't.

Mind you, I love neat for the sake of it, and if that's the intent, well and
good. But wondered if there was something else I was overlooking.

~~~
mkn
It may be premature to say that it's neat just for the sake of neatness. It
may not have a direct UI usage, but we could probably learn something about
mouse events and drawing by examining the code, for example. Also, from a UI
perspective, you migh be able to make mousing more efficient by dragging UI
elements around in a cloud around the mouse. (You could fade them out so that
they were just barely visible, for example, until you right-clicked or shift-
right-clicked to pin them down and use them.) It looked, at first glance, like
the effect was running on a Canvas, so I don't know how easy it would be to do
outside of one.

Also, call it mkn's first law: There's _always_ something you're overlooking.
(Where 'you' is the hypothetical you, not you in particular.) :o)

~~~
contextmenu
We have that, it's called a context menu.

~~~
sutro
We've all heard of single serving sites:
<http://news.ycombinator.com/item?id=399941>. Here the parent commenter is
pioneering the latest incarnation of the trend: the single serving HN account.

~~~
captainobvious
Someone quick! Find a phone and call captain obvious.

------
tlrobinson
It makes it kind of hard to click the green links.

------
axod
This leaves blue "snow" artifacts on Safari 3.2.1. Seems like there's a bug in
Safari's rendering.

Cool effect though.

~~~
kqr2
I see some of the blue snow artifacts on firefox 3.0.5 too so it's probably
not a bug in Safari.

------
ideamonk
Wow!! this is amazing... waiting for Doom II clone in Javascript :)

------
revicon
Neat!

