2010.08.08

Canvas Method Chaining

This week I’ve done some stuff using the HTML5 canvas and one feature that I kind missed was method chaining, so I decided to implement it…

It isn’t something ground-breaking - other people done it before (Canto.js, MDC canvas, p01, …) - but I decided to implement it by myself since it’s something simple, the other solutions are way more complex than what I needed, source code isn’t that clean and/or overwrites native objects prototypes (possibly causing conflicts/issues), etc…

I’ve released the code as open source under the WTFPL and it is available on GitHub.

Check the project page on GitHub for more details.

I hope it is useful for someone.

PS: I’m not a big fan of method chaining since code tends to be become “more cryptic” but sometimes it makes sense to use, use it with moderation!


Comments

Leave a Comment

Please post only comments that will add value to the content of this page. Please read the about page to understand the objective of this blog and the way I think about it. Thanks.

Comments are parsed as Markdown and you can use basic HTML tags (a, blockquote, cite, code, del, em, strong) but some code may be striped if not escaped (specially PHP and HTML tags that aren't on the list). Line and paragraph breaks automatic. Code blocks should be indented with 4 spaces.