How to manipulate Canvas elements: Difference between revisions

Jump to navigation Jump to search
Line 120: Line 120:
var root = myCanvas.createGroup();
var root = myCanvas.createGroup();
var myGroup = root.createChild("group");
var myGroup = root.createChild("group");
var (red,blue,grey) = ['#ee0000', [0,0,1], [.8,.8,.8] ];
var (red,blue,green) = ['#ee0000', [0,0,1], [0,0.8,0] ];
  ## with default values:
canvas.plot2D.polyline(myGroup,[150,181,194,157,199],[52,20,64,28,36]);
canvas.plot2D.polyline(myGroup,[150,181,194,157,199],[162,130,174,138,146]);
  ## 3 vertices with default values:
canvas.plot2D.polyline(myGroup,[100,110,150],[50,90,100]);
canvas.plot2D.polyline(myGroup,[20,30,70],[15,55,65]);
   ## with symmetrical = 'x':
   ## 3 vertices with symmetrical = 'x':
canvas.plot2D.polyline(myGroup,[100,110,150],[50,90,100],'#0',"x")
canvas.plot2D.polyline(myGroup,[20,30,70],[130,170,180],blue,"x");
          .setTranslation(-10,-10);
   ## 3 vertices with symmetrical = 'y':
   ## with symmetrical = 'y':
canvas.plot2D.polyline(myGroup,[150,160,200],[90,130,140],red,"y");
canvas.plot2D.polyline(myGroup,[100,110,150],[50,90,100],'#0',"y")
   ## 3 vertices with symmetrical = 'xy':
          .setTranslation(-10,-10);
canvas.plot2D.polyline(myGroup,[50,60,100],[100,140,150],green,"xy");
   ## with symmetrical = 'xy':
   ## 3 vertices with symmetrical = 'yx':
canvas.plot2D.polyline(myGroup,[100,110,150],[50,90,100],'#0',"x")
canvas.plot2D.polyline(myGroup,[100,110,150],[50,90,100],'#0',"yx");
          .setTranslation(-10,-10);
   ## with symmetrical = 'yx':
canvas.plot2D.polyline(myGroup,[100,110,150],[50,90,100],'#0',"x")
          .setTranslation(-10,-10);
</syntaxhighlight>
</syntaxhighlight>
|| [[File:Plot2D.rectangle and grid.png|thumb]]
|| [[File:Plot2D.rectangle and grid.png|thumb]]
229

edits

Navigation menu