paper.js/src/util/CanvasProvider.js

16 lines
314 B
JavaScript
Raw Normal View History

CanvasProvider = {
canvases: [],
getCanvas: function(width, height) {
var canvas = this.canvases.length
? this.canvases.pop()
: document.createElement('canvas');
canvas.width = width;
canvas.height = height;
return canvas;
},
returnCanvas: function(canvas) {
this.canvases.push(canvas);
}
};