News for hackers. Stuff that matters.
Re:Hair by kybernetyk on Thursday June 20, 2013 @04:53AM (#5910959)
Ok, sorry for being ignorant but I'm not a web developer. So: What is so special about this? Is there some new technology in use?

I'm clearly not getting something with this submission.

Re:Hair by olalonde on Thursday June 20, 2013 @05:16AM (#5911024)
1. Demonstrates a cool algorithm most HNers are not familiar with.

2. It's written in a language most HNers are familiar with.

3. Doesn't require any special environment to watch or play with.

4. It's open source.

Re:Hair by a-nikolaev on Thursday June 20, 2013 @09:29AM (#5911905)
I think, the algorithm is not really special btw. In fact this is very basic physics simulation. I could not decipher the JS code, but each lock can be replicated as a chain of connected nodes (i.e. there is a force between them or a constraint to keep them connected) + added radial force from the mouse + small random noise.

You keep track of each node's position, and its velocity. If connectedness is simulated as a force, it can be as simple as

1) Compute force {Fx,Fy} for each node, then integrate:

2) vx(t+dt) = vx(t) + (Fx/m) * dt

3) x(t+dt) = x(t) + vx(t+dt) * dt

If it is using constraints than the code is more complex though, but for this kind of simulation constraints are overshoot probably.

You can add gravity too, it can be a fun addition..

Re:Hair by _pmf_ on Thursday June 20, 2013 @05:05AM (#5910991)
It runs on "The Web (TM)"[1] without plugin. That makes it very amazing and innovative, apparently.

[1] "The Web (TM)" being just the right combination of operating system, specific browser version and graphic card.

Re:Hair by smackfu on Thursday June 20, 2013 @11:26AM (#5912627)
And the funny thing is that the main things that make these demos possible are:

1) They finally said "ok, you can just update pixels directly like a 1980s computer".

2) Computers are fast enough to run Javascript at decent frame rates now.

Re:Hair by hkmurakami on Thursday June 20, 2013 @05:11AM (#5911006)
kind of like the "net" interactive animation with physics in the browser which iirc was done with asm.js (there was a thread on HN about a month ago but I can't seem to find it now)
Re:Hair by andyjohnson0 on Thursday June 20, 2013 @05:36AM (#5911076)
Tearable Cloth Simulation in JavaScript

https://news.ycombinator.com/item?id=5592679

Re:Hair by kevincennis on Thursday June 20, 2013 @08:55AM (#5911733)
I can't really speak to why it would be interesting to non-web developers.

But for those of us whose days consist mostly of writing JavaScript, this is pretty cool. Stuff like this hasn't been possible until recently, and I would guess (anecdotally) that most of us don't have much experience with coding graphics/animation.

It's not that anyone thinks this is groundbreaking computer science. It's just introducing something interesting and fun to developers who might not have known this kind of thing was even possible.