ART creates a new surface to draw on.
Creates a new surface.
var art = new ART([width, height]);
var art = new ART(300, 400);
// Inject it in our page using MooTools
$('myElement').adopt(art);
Resizes the surface to a new width and height. The surface content is cropped, not scaled.
art.resize(width, height);
Injects the surface into the bottom a DOM element.
art.inject(container);
var art = new ART(500, 500).inject(document.body);
Removes the surface from the DOM container. Leaving it free to be garbage collected or injected somewhere else.
art.eject();
var art = new ART(500, 500).inject(document.body);
art.subscribe('click', function(){
art.eject();
});
Grabs one or more ART.Group or ART.Shape instances and injects them into this surface’s content. The child instances are ejected from their previous container.
The new children are rendered in front of any existing content.
art.grab(child[, child[, ...]]);
var art = new ART(500, 500);
var rectangle = new ART.Rectangle(400, 200).fill('black');
var circle = new ART.Ellipse(200).fill('red');
var group = new ART.Group()
.grab(rectangle, circle)
.inject(art);