Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
53 lines (44 sloc) 1.05 KB
<!doctype html>
<html>
<head>
<!-- test the donatello api features. -->
<script src="../donatello.js" type="text/javascript"></script>
<script src="../rect.js" type="text/javascript"></script>
<script src="../circle.js" type="text/javascript"></script>
<script src="../text.js" type="text/javascript"></script>
<script>
var line;
function main() {
var paper = Donatello.paper('paper-div', 20, 20, 300, 300 );
// common attributes
var attrs = {
stroke:'red',
'stroke-width':5
};
// nested objects using chaining
paper
.rect( 0, 0, 50, 50, attrs )
.rect( 10, 10, 50, 50, attrs );
// sibling objects using chaining
paper
.rect( 20, 20, 50, 50, attrs ).parent()
.rect( 40, 40, 50, 50, attrs );
paper
.circle( 20, 20, 10, attrs ).parent()
.circle( 40, 40, 10, attrs );
paper
.text( 20, 20, "foo" ).parent()
.text( 40, 40, "bar" );
}
</script>
<style>
#paper-div {
border: 1px solid black
}
</style>
</head>
<body onload='main();'>
<div id="paper-div">
</div>
</body>
</html>