How to manipulate Canvas elements: Difference between revisions

Jump to navigation Jump to search
Line 247: Line 247:
            'center-top', 'center-center', 'center-bottom',
            'center-top', 'center-center', 'center-bottom',
'right-top', 'right-center', or 'right-bottom'.<br />
'right-top', 'right-center', or 'right-bottom'.<br />
== Behind the scene ==
Let's see in detail the elements Canvas.<br />
Open the '''Nasal REPL Interpreter''' and execute (you can copy&paste, then {{key press|Enter}}:
<syntaxhighlight>
var window = canvas.Window.new([300,200],"dialog").set("title","Plot2D demo"  );
var myCanvas = window.createCanvas().set("background", "#eeeeee");
var root = myCanvas.createGroup();
var myGroup = root.createChild("group");</syntaxhighlight>
We have our new canvas, ready to play with.<br />
At the ''>>>'' prompt type:<syntaxhighlight>
var arrow = canvas.plot2D.polyline(myGroup,[90,120,10],[20,30,30],'#0',"y").setStrokeLineWidth(3);</syntaxhighlight>
Do not forget the {{key press|Enter}}.<br />
You should have something like [[File:My_Arrow.png|none]] Noy
229

edits

Navigation menu