Blogging from Inside the New Media Revolution

Smibs on code: JavaScript lines

2 Comments
By Forrest - March 13th, 2009

This is going to be another short post where I share some code, and much more importantly provide a demo to play with. There have been a number of times when our team has an idea that would require some creative drawing & lines in a browser. This is traditionally Flash territory. There has been lots of work with canvases to allow drawing in Javascript, but these are still exploratory and are not really ready for the lime-light.

It is actually quite possible to draw lines on the screen. An excellent explanation of an efficient method can be found at http://www.p01.org/releases/Drawing_lines_in_JavaScript/ (I believe it was written by Mathieu ‘P01′ HENRI) I recently turned this method into a Prototype class with some useful functionality.

My demo is at http://lines.live2code.ca (Tested on IE7, IE8, FF3 & Safari)
or you can check out the code at http://github.com/forrest/javascript-line-class

Tags: ,

Filed under: Smibs on Code, Technology  •  Tagged: Tags: ,
  1. Forrest March 13, 2009 at 1:52 pm

    I forgot to mention it, but I love talking to developers and meeting new people. I would love to hear from you at http://twitter.com/fzeisler

  2. Peter Urban March 13, 2009 at 7:20 pm

    Nice touch. Can you make the lines to stay on the canvas?

Leave comment

NOTE: We’d rather not moderate, but inappropropriate comments may be removed. Repeat offenders will be banned from commenting. Now, let’s focus on adding fun and valuable content. Thank you