-
Notifications
You must be signed in to change notification settings - Fork 0
Canvas.js
Danny Garcia edited this page Sep 29, 2012
·
3 revisions
The purpose of Canvas.js is as follows:
- Quick and flexible method for embedding a
<canvas>node. - Easy access to getting / setting the canvas context.
- Help with small things like window resizing and pixel ratios.
context [str] - Context type.
container [dom] - <canvas> container.
width [num/str] - Canvas width. "auto" fits to container.
height [num/str] - Canvas height. "auto" fits to container.
resize [bool] - Should the canvas width/height be reset when the window is resized?
<div id="canvas"></div>// Standard
(function () {
var cvs = new fil.Canvas();
cvs.init({
container : document.getElementById('canvas')
});
var ctx = cvs.context();
// Do cool things with canvas here.
}());
// AMD
require(["Canvas"], function (Canvas) {
var cvs = new fil.Canvas();
cvs.init({
container : document.getElementById('canvas')
});
var ctx = cvs.context();
// Do cool things with canvas here.
});