Hair
codepen.io
codepen.io
http://genesisbbs.com/appstem/appstem.html
(Warning: uses Flash!!)
I tried it twice (I'm a masochist, I guess).
It somehow took over all the computer time (realtime priority?), and chrome wasn't even using 100% of the CPU time in Task Manager.
Everything froze up except the mouse, which moved like it was underwater.
More info: https://support.google.com/chrome/answer/1220892?hl=en
I'm clearly not getting something with this submission.
[1] "The Web (TM)" being just the right combination of operating system, specific browser version and graphic card.
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.
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.
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..
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.
Can anyone tell me what areas of math should I look at learning to comprehend (maybe even produce) this kind of thing?
Yeah, geometry is pretty much math (that's why I separated it in the parent comment) but physics justs uses math to model and express the physic concepts.
The math behind the physics on this demo is just addition, subtraction, multiplication... He shouldn't be concerned about the math, but about the physics... unless he doesn't know elementary math of course.
The math behind the basic Newtonian Physics is damn simple. The geometry is very simple too (basic Euclidean Geometry, Bezier curves and that's pretty much it).
1. Reverse engineer it by playing with the code. This is, of course, the very ethos of these code share sites.
2. Learn the basics of physics & geometry on your own and come back to it.
Feel free to choose either method, but for the developer who is curious, option 1 is a lot faster.
Economics isn't math even if economics uses math all the time.
The rest of your comment is correct but irrelevant. He could (and should) go learn the physics he's lacking... but he would probably not learn a single new math concept.
The math needed to express these physics concepts is taught in secondary education (addition, subtraction, multiplication, vectors... not much more).
The "physics" he didn't understand in the code IS math, though. That's the point. Even if you know physics, you won't be able to understand the code without the math.
The fact that the program is implemented by using " just addition, subtraction, multiplication" is irrelevant, because this is how computers (and mathematical numerical methods) work.
For many great mathematicians the difference between math and physics is almost non-existent. You may also read this guy, btw https://en.wikipedia.org/wiki/Vladimir_Arnold
With a lot of physics-based math the best way to see what everything does (assuming you don't understand the core concepts out of the gate) is to just tweak all of the vars that contribute to size, shape and movement to see how they work.
Seriously though it's the writing part that I couldn't do - I'd be happy to come back and not understand something if I could even write it in the first place!
However, I was really disappointed to see that the code had been minified. Doesn't that kind of go against the point of codepen et al?
[Error] TypeError: 'undefined' is not an object (evaluating 'g.getOrigin')
y (BHIek, line 170)
dispatch (BHIek, line 170)
loop (BHIek, line 170)
(anonyme Funktion)Uncaught TypeError: Cannot call method 'getOrigin' of undefined BHIek:170 and on BHIek:154
[1] http://www.paulirish.com/2011/requestanimationframe-for-smar...
There is good reason why we don't use flash today though right? It is resource intensive (looks at task manager and realizes that browser with hair page open is eating up 12% of i7 processor).
http://stackoverflow.com/questions/15363798/which-mobile-bro...
iOS5 with Nitro Javascript
Chrome for Android on Android4+ (default browser)
Windows Phone 7 with IE9
I don't see Blackberry providing any support but...Sincerely,
The Demoscene
You didn't see anything like this 12 years ago, because it simply wasn't possible with just HTML. You had to use a closed source, expensive tool to do it. And 12 years ago, when it was being done by people like Joshua Davies, Manny Tan, that guy behind assembler.org, they were doing something very, very important: they were bringing computer art to every living room, they were exploring generative algorithmic art and they were advancing the idea of what could be done with tech of that time. It was pretty important shit.
This code is useful in a lot of practical ways - games coming to mind almost instantly. But not everything has to be practical. Something can just be beautiful. I find this to be beautiful and fun.
HN needs less posts like yours. It used to not have them. I am glad to see some positive in other comments in this thread, but your comment in particular is relatively useless. Particularly after you admit to using Windows in 2013. That's like someone driving a Ford telling me what a waste of metal a work of art like a Lamborghini is.
I found his comment not very snarky, but quite interesting, indeed, one of the main arguments against Flash, and here we are with the same drawback with this amazing new technology.
Well, not to nitpick but Linux also has a task manager, and in many desktops it is also called a task manager, I believe in KDE that was the kase.
That said, he should just replace "task manager" with "top" or whatever to get him over the OS snobbery stuff that I thought sailed into the sunset years ago. It's really, really dumb to judge someone by the OS they happen to be using at any given moment, especially when they're commenting on a cross-platform technology.
That is perhaps extreme, but I guess a valid question. Think about it though, the author did not have to create anything but he/she did spend his own time creating this. Furthermore, the author did not have to share it with us but he/she still did. So why the negative (and unconstructive) feedback? Why not just not upvote and move on?
> Particularly after you admit to using Windows in 2013. That's like someone driving a Ford telling me what a waste of metal a work of art like a Lamborghini is.
Which is a shame because I thought you had a good point up until then.
In any case - was the original/root comment here really that bad? Honestly...
Yes. One of the things that HN has been in the past, and should try to be in the future, is a place where people can post their projects and feel like they'll receive constructive feedback. If scoring cheap status points by tearing people down is what you want, you can check out literally any other large online community.
If you'd rather have a community where nobody can speak their mind and everybody walks on eggshells though - perhaps you should start a smaller online where you can implement that rule. Otherwise - let's just keep adding to the noise, shall we?
But there was nothing constructive in goggles99's comment, and its general tone was mean. It doesn't pass the "real life test"; if OP had shown this demo to a group of people face to face, only an asshole would have responded with what goggles99 said.
>Otherwise - let's just keep adding to the noise, shall we?
You might not be aware of it, but what you're doing here is known as "derailing".
How am I the one derailing here? I didn't start on this topic. If I'm derailing, so are you. You can stop responding at any time.
I hear all this whining that flash was closed source and not an open standard, yet we are stuck in a proprietary mess of similar sorts and I don't hear complaints about that. We are relegated to all learn HTML5/CSS/JS. Doesn't that piss anyone else off? What if when writing applications for Windows, Mac and Linux, you could only choose one programming language, one markup language, and one layout/styling/positioning language? You would be pissed as hell. Well the browser is the OS of the web so why aren't you pissed off? Why is everyone so exited and happy for HTML5? It should be thrown back in the faces of the consortium and a loud demand for what I mentioned earlier should be put out.
THEN we would see some REAL INNOVATION. Let the people, the hackers/developers release their creative energy on the building blocks of the web. Give us the freedom to do it. Open standards that are so high level (such as a specific language following exact specifications) are causing stagnation of innovation.
Flash applications also tended to have poorly integrated user interfaces. All of the standard web-browing features (back, forward, copy link location, save image, open link in new window, etc.) had to be replicated by the developer of each individual application. So most of them functioned poorly.
And CPU utilization was not the metric people used against flash with regard to performance complaints. The metric was time spent waiting for the goddamn site to load. People complained about flash's performance in two main scenarios. The first, were sites that were supposed to be useful that tried to be overly creative with intro movies and fancy dynamic menus that users had to wait for. The second scenario was pages with flash-based ads, where once again, content on the page would take longer to display because the browser was busy downloading and running banner ads that were 100x the size and complexity of the target content.
Also, Flash is a pain to get working on *BSD and is no longer supported on Linux, which is reason enough to move to JS.
HTML5 isn't necessarily about lower CPU, it's about openness, cross-platform compatibility and integrating with other browser elements, all of which Flash completely fails at.
Also it's a pretty neat animation and works without plugins, provided your system OpenGL version is recent enough.
I haven't tested it, but I don't think this requires OpenGL at all. It appears to be purely canvas 2D, which is not WebGL.
Who even writes ugly code like this:
.slice(0),this.depMaps.rjsSkipMap=e.rjsSkipMap,this.errback=n,this.inited=!0,this.ignore=r.ignore,r.enabled||this.enabled?this.enable():this.check()},defineDepById:function(e,t){var n;return each(this.depMaps,function(t,r){if(t.id===e)return n=r,!0}),this.defineDep(n,t)},defineDep:function(e,t){this.depMatched[e]||(this.depMatched[e]=!0,this.depCount-=1,this.depExports[e]=t)},fetch:function(){if(this.fetched)return;this.fetched=!0,r.startTime=(new Date).getTime();var e=this.map;if(!this.shim)return e.prefix?this.callPlugin():this.load();T(this,!0)(this.shim.deps||[],bind(this,function(){return e.prefix?this.callPlugin():this.load()}))},load:function(){var e=this.map.url;c[e]||(c[e]=!0,r.load(this.map.id,e))},check:function(e){if(!this.enabled||this.enabling)return;var