Hacker News new | past | comments | ask | show | jobs | submit login
OCanvas – an object-based canvas drawing library (ocanvas.org)
34 points by hakim on March 26, 2011 | hide | past | favorite | 9 comments



Interesting, but it feels like a re-implementation of SVG. What is the advantage of this over something like RaphaelJS[1], where the SVG/VML objects are actual DOM objects already?

[1]: http://raphaeljs.com/


Recently, I have been examining various 2D html APIs. I find the oCanvas API to be excellent.

In comparison with Raphael, I find that both libraries are good and useful.

In computer graphics, there are two main approaches for 2D: vector and bitmap. Each one has their situations where it is the most convenient. Raphael is SVG based, vector graphics. oCanvas is html canvas based, bitmap graphics. So each one will have situations where it is the most convenient.

For example, scalable graphics, made of solid lines and shapes, are better suited with the vector approach. While diffuse images and image processing is better suited with the bitmap approach.

oCanvas employs object literals to accede to the various graphic operations. I find that makes the code more readable and thus easier to maintain, than the Raphael API, which makes use of plain function parameters for that.

Some differences that I found: Raphael have support for paths, vector fonts, and premade charts, which oCanvas doesn’t have.

On the other hand, oCanvas have support for animated sprites, scenes and timeline/game loop.


EaselJS is much easier to write it. http://easeljs.com/

And with real classes, and real methods. O canvas seems like the graphics class alone: http://easeljs.com/docs/Graphics.html


Similar to EaselJS, http://easeljs.com/


Looks nice, but as the first comment says: seems to recreate what RaphaelJS does.

And, the demo site fails utterly on IE7: the documentation website says nothing about browser compatibility.


As nxn said, IE9 is the first release with canvas support. But even there oCanvas won't work currently I think. Browser compatibility was not my highest priority before the first release. But that will be tested and improved in later releases. I have also noticed that Opera has really weird rendering on both Mac and Windows. Windows browsers in general are also a little quirky on this. But it will be tested and improved more soon.


Well, Internet Explorer's canvas implementation only begins with IE9. I would not expect a lib that is based on canvas to work in any previous version of that browser.

EDIT: And even then, you only get the 2d context, can't do any WebGL fancystuff with any IE. (Though I don't think oCanvas does any of that anyway?).


WebGL is not really canvas, it used to be called canvas 3d at first but now I think people just refer to it as webgl because it's completely different, I may be wrong though.


Actually it's very similar to StrikeDisplay (posted a while back, but I don't think anyone saw it): http://news.ycombinator.com/item?id=1816482 http://strikedisplay.blogspot.com

SD tries to handle things like child objects dispatching events up the display chain and implementing an AS3-style pseudolanguage...




Consider applying for YC's Summer 2025 batch! Applications are open till May 13

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: