mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-09 06:12:34 -05:00
16 lines
314 B
JavaScript
16 lines
314 B
JavaScript
|
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);
|
||
|
}
|
||
|
};
|