News Roundup: Canto, Unveil, DailyJS on Mobile
Canvas is one of the most exciting features of HTML5, but it’s not necessarily an easy tool to use. Even once you’ve gotten the hang of it, the code written in service of the API can be extremely verbose, and not very pleasant to look at. No less than David Flanagan, author of the Rhino book, has written a very handy wrapper library around Canvas. Canto offers several huge improvements on the API. One of the simplest but most impactful improvements is the ability to chain method calls. Additionally, Canto extends the existing Canvas methods, such as
lineTo(), to let you specify more than two arguments. Doing so will invoke the same methods multiple times. Additionally, Canto includes methods that mimic the behavior of the
path attribute of the SVG element, allowing you to do SVG-like drawing within a Canvas element.
Note that Canto doesn’t include any major abstractions on top of the existing Canvas API, so if you don’t understand the basics of Canvas, it isn’t going to write your drawing code for you. However, it will save you a heck of a lot of typing and probably make your drawing code more readable and maintainable. If you’re doing any Canvas work, it’s definitely worth giving Canto a look.
Speaking of Canvas, Unveil is a very promising new data visualization library that draws its graphs using Canvas. Unveil creates rich, interactive graphs using JSON datasets. It has lots of common graph types built in (histograms, scatter plots, and some others), and also has an intuitive API for creating new chart types.
One of the ways in which Unveil differs from other, similar libraries is in the ability to specify different framerates for different stages in an animation. This allows you to increase the framerate when there’s a lot of movement in the graph, but then to lower the framerate again between major actions. This helps keep CPU utilization to a minimum.
Unveil is in the fairly early stages, so the library’s author recommends not using it outside of WebKit browsers yet. But once the cross-browser bugs are squashed, it’s going to be extremely useful. If you’re curious to learn more, check out the (very good) documentation.
On the whole, Unveil gives you a lot of very Flash-like interactivity in Canvas. This is exactly the kind of tool we need more of if Canvas is going to make inroads in creating animations in the browser without plugins.
DailyJS on Touch Devices