Created
January 20, 2009 13:15
-
-
Save martinstannard/49469 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(document).ready(function() { | |
| // Creates canvas 320 × 200 at 10, 50 | |
| var rects = new Array(); | |
| var data = [10, 20, 30, 40, 50, 60]; | |
| console.log(data.length); | |
| var paper = Raphael(10, 50, 640, 480); | |
| var i = 0; | |
| for (i = 0; i < data.length; i++) { | |
| // Creates starting rects | |
| var rect = paper.rect(0, i*30, 10, 25); | |
| // Sets the fill attribute of the rect to red (#f00) | |
| rect.attr("fill", "#f00"); | |
| // Sets the stroke attribute of the rect to black (#000) | |
| rect.attr("stroke", "#000"); | |
| rects[i] = rect; | |
| }; | |
| // animate the rects | |
| var c; | |
| for (c in rects) { | |
| rects[c].animate({width: data[c] * 4}, 2000); | |
| }; | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment