Testing Raphael graphics
"Raphael is a small JavaScript library that should simplify your work with vector graphics on the web"
<?xml version="1.0" encoding="UTF-8"?>
<!--Xholon Workbook http://www.primordion.com/Xholon/wb/ (C) Ken Webb Wed Apr 04 2012 20:59:32 GMT-0400 (EDT)-->
<XholonWorkbook>
<Notes><![CDATA[
Xholon
------
Title: Testing Raphael graphics
Description: "Raphael is a small JavaScript library that should simplify your work with vector graphics on the web"
Url: http://raphaeljs.com/
InternalName:
YoutubeId:
Keywords:
My Notes
--------
This is just a quick test that doesn't do much::
Click the Run button above.
The Workbook will download the Raphaël JavaScript library, and display a runtime overlay.
Click the Step button in the overlay.
The overlay will create and display a circle.
For the JavaScript code that does this, scroll down to the Blockbehavior editor below.
The act() function has the code that draws the circle.
If you edit the code, press Refresh and Step to see the results.
]]></Notes>
<script implName="lang:python:inline:"><![CDATA[
#print "height = 12.34 m"
]]></script>
<script implName="lang:javascript:inline:"><![CDATA[
//print("height = 56.78 meters\n");
]]></script>
<_-.XholonClass>
<!-- domain objects -->
<PhysicalSystem/>
<Block/>
</_-.XholonClass>
<xholonClassDetails>
</xholonClassDetails>
<PhysicalSystem>
<Block/>
</PhysicalSystem>
<Blockbehavior implName="lang:python:inline:"><![CDATA[
# This works if pasted in as a last child of Block.
#height.incVal(0.02)
#print("Python wants something to do. Height:" + str(height))
]]></Blockbehavior>
<Blockbehavior implName="lang:javascript:inline:"><![CDATA[
// This works if pasted in as a last child of Block.
//height.incVal(0.02);
//print("JavaScript wants something to do. Height:" + height + "\n");
]]></Blockbehavior>
<Blockbehavior implName="lang:webEditionjs:inline:"><![CDATA[
function postConfigure() {
this.xholoncreationservice('requireScript', 'raphael-min.js');
}
function act() {
// use the existing SVG div, and remove any content it has
var mySVGDiv = $("div#mySVGDiv");
mySVGDiv.empty();
// simple demo slightly altered from the Raphaël main page
var paper = Raphael(mySVGDiv[0], 100, 100);
// Creates circle at x = 50, y = 40, with radius 30
var circle = paper.circle(50, 40, 30);
// Sets the fill attribute of the circle to red (#f00)
circle.attr("fill", "#f00");
// Sets the stroke attribute of the circle to blue
circle.attr("stroke", "#00f");
}
]]></Blockbehavior>
<Blockbehavior implName="lang:bsh:inline:"><![CDATA[
// This works if pasted in as a last child of Block.
//height.incVal(0.02);
//System.out.print("Java/Beanshell wants something to do. Height:" + height + "\n");
]]></Blockbehavior>
<Blockbehavior implName="lang:jruby:inline:"><![CDATA[
#require 'java'
# This works if pasted in as a last child of Block.
#$height.incVal(0.02)
#puts "Ruby wants something to do. Height: #{$height}"
]]></Blockbehavior>
<Blockbehavior implName="lang:groovy:inline:"><![CDATA[
// This works if pasted in as a last child of Block.
//height.incVal(0.02);
//System.out.print("Groovy wants something to do. Height:" + height + "\n");
]]></Blockbehavior>
<SvgClient><Attribute_String roleName="svgUri"><![CDATA[data:image/svg+xml,
<svg width="1" height="1" xmlns="http://www.w3.org/2000/svg">
</svg>
]]></Attribute_String><Attribute_String roleName="setup">${MODELNAME_DEFAULT},${SVGURI_DEFAULT}</Attribute_String></SvgClient>
</XholonWorkbook>