Live data from Hacker News

Two.js

jonobr1.github.io

11–20 of 64 posts

Re: Two.js

#11
I'd be curious to see the performance differences between this drawing on 2d canvas, webgl and similar code in plain JS. Mostly curious at that webgl benchmark

Re: Two.js

#13
I don't get it. Retained-mode vector graphics == SVG. Browsers with canvas or webgl also have SVG. So what does this accomplish?

I don't mean to sound negative, I'm just not clear on the point.

Re: Two.js

#15
post #5

Was pretty confused at first about why this would have a Backbone dependency until I looked through the source and saw they they're just pulling Backbone.Events. I think it says a lot about Backbone that people are doing things like that. Modularity is nice. Oh, and thumbs up for Two.js. Well done.

The decision for Backbone events vs other events is based on this performance review: http://jsperf.com/events-vs-events2/25

That's not a big surprise. jQuery's events use native browser events behind the scenes. Which is nice for dom-oriented plugins; you get bubbling for free and all the native event listeners just work. It's got a pretty fair amount of overhead though. Backbone's events are just a pure JS event emitter implementation.

I'm curious, though, why they added an external dependency instead of just inlining a solution. There's a couple of good MIT licenced barebones implementations[1][2] floating around, and it's pretty straightforward to reimplement yourself in an hour or two if you prefer.

[1] https://github.com/Wolfy87/EventEmitter [2] https://github.com/hij1nx/EventEmitter2

Re: Two.js

#16

I don't get it. Retained-mode vector graphics == SVG. Browsers with canvas or webgl also have SVG. So what does this accomplish? I don't mean to sound negative, I'm just not clear on the point.

I find this to be a very relevant article on render times between various contexts: http://smus.com/canvas-vs-svg-performance/

Along these lines I've written projects in canvas only to realize later I should've written in SVG. One of the aims of two.js is to afford a canonical API for the developer. So the idea is that if you're rendering lots of particles and not doing any manipulation to individual particles, canvas or webgl will render faster than svg. Two.js aims to make it easier to test and switch around between the contexts. However, I should caveat all of this with two.js is very nascent...

Re: Two.js

#17
post #15
post #5

Earlier quoted context omitted.

The decision for Backbone events vs other events is based on this performance review: http://jsperf.com/events-vs-events2/25

That's not a big surprise. jQuery's events use native browser events behind the scenes. Which is nice for dom-oriented plugins; you get bubbling for free and all the native event listeners just work. It's got a pretty fair amount of overhead though. Backbone's events are just a pure JS event emitter implementation. I'm curious, though, why they added an external dependency instead of just inlining a solution. There's…

I was not aware of these other event systems in JavaScript. Thanks for pointing these out!

Re: Two.js

#18
This landing page and documentation is just beautiful. Simple hashtag nav, soft colors, great header, and good examples. Only suggestion would be to have a way to link to individual methods in the docs w/ hashes. I really commend the effort here.
Post reply on HN