开发者

Which javascript package provides a rich object model for drawing different shapes on the HTML5 Canvas

开发者 https://www.devze.com 2023-01-28 02:24 出处:网络
What is the best javascript packag开发者_开发知识库e for drawing different shapes (circle, rectangle, ball, table, ...) on the HTML5 CanvasWhen it comes to drawing things like balls, tables etc. you p

What is the best javascript packag开发者_开发知识库e for drawing different shapes (circle, rectangle, ball, table, ...) on the HTML5 Canvas


When it comes to drawing things like balls, tables etc. you probably want to just use clip art. Then to tie it all together (lines, ellipses, etc. etc. and images) you could use Processing.js with its image() function, or do it directly in JavaScript (a bit more difficult but not hard).


I recently found a nice javascript library called Joint. It is a JS library for drawing diagrams on a SVG/VML canvas. It is build on top of the Raphaël library, which you should definitely check out if you want a nice basic set of drawing tools. Althouhg they are not drawing to the HTML canvas, they are definitely worth checking out, if you need to draw something with javascript.


Gury is a simple canvas wrapper with a "fluent interface" (think jQuery).

While it doesn't really have drawing primitives per se (at least not yet), it should be fairly simple to create your own and be able to reuse them.

Follow this link to see the page where I learned of it. There's a very small intro and some sample code there.

If you're interested the source file for the demos on Gury's homepage also shows how you draw several stuff, including boxes, balls and even slider widgets. Just search for the different draw functions.


If you are wanting to draw 3D shapes three.js looks pretty promising. It's still in active development and the demos are really the only documentation at the moment but looks to be pretty functional as it stands now.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号