See example: http://jsfiddle.net/SyQYp/4/
Created
August 21, 2012 17:05
-
-
Save iros/3417353 to your computer and use it in GitHub Desktop.
Using BonsaiJS in JSFiddle
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
<div id="stage"></div> | |
<script> | |
(function(){ | |
var s="script", | |
i="code", | |
n='\n', | |
d=document, | |
b=d.getElementsByTagName(s)[2].innerHTML.split(n); | |
d.write('<' + s + ' type="text/bonsaijs" id="' + i + '">' + | |
b.slice(2,b.length-3).join(n)+'</'+s+'>') | |
} | |
)(); | |
</script> | |
<script> | |
$(function() { | |
var stage = document.getElementById('stage'); | |
bonsai.run(stage, { | |
code: document.getElementById('code').innerHTML | |
}); | |
}); | |
</script> |
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
var square = new Rect(0, 0, 100, 100); | |
square.addTo(stage); | |
square.fill('red'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment