Created
March 25, 2011 06:27
-
-
Save brettz9/886440 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get first canvas tag on page | |
var ctx = C2D2(); | |
// Wrap a specific canvas DOM element | |
var ctx = C2D2(myCanvas); | |
// Use existing canvas tag (by string ID) | |
var ctx = C2D2('cnv'); | |
// Single argument array; creating a new canvas and context and adding canvas to the body | |
var ctx = C2D2([1000, 450]); | |
// Dual argument array and configuration: specifying creation of canvas with other attributes for appending canvas to the body | |
var ctx = C2D2([1000, 450], {id:'cnv'}) | |
// Single argument object with custom appendTo element as ID string: | |
var ctx = C2D2({width: 1000, height: 550, id:'cnv', appendTo: 'myId'}); | |
// Single argument object with custom appendTo element as DOM element: | |
var ctx = C2D2({width: 1000, height: 550, id:'cnv', appendTo: document.body}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment