canvas.settings.addCanvas element

getCanvas(id).settings.add( x, y, element )

Places element onto the canvas at the coordinates (x, y).

Note that you do not need to call print on the added element: it will be printed along with the canvas.

Note also that if you pass an element that was already added to the page before, the element will be moved from its original location on the page to the specified coordinates on the canvas, leaving no blank space at the original location. In the particular case where the element was on the canvas before, the result appears as a simple update of its coordinates on the surface.

Example:

[js highlight=”6″ try=”true”]newImage(“square”, “square.png”)
.settings.size(50, 50)
,
newCanvas(“shape”, 100, 100)
.settings.center()
.settings.add( 25, 25, getImage(“square”) )
.print()[/js]

Adds a <div> of size 100x100px to the horizontal center of the page and places a 50x50px image of square.png 25px away from the left edge of the canvas and 25px away from the top edge of the canvas, so that the image appears centered on the surface.