{"name":"get-canvas-context","version":"1.0.1","description":"gets canvas context by name","main":"index.js","license":"MIT","author":{"name":"Matt DesLauriers","email":"dave.des@gmail.com","url":"https://github.com/mattdesl"},"dependencies":{},"devDependencies":{"browserify":"^10.2.4","faucet":"0.0.1","smokestack":"^3.3.0","tape":"^4.0.0"},"scripts":{"test":"browserify test.js | smokestack | faucet"},"keywords":["canvas","context","2d","webgl","experimental","webgl2","3d","gl","html5"],"repository":{"type":"git","url":"git://github.com/Jam3/get-canvas-context.git"},"homepage":"https://github.com/Jam3/get-canvas-context","bugs":{"url":"https://github.com/Jam3/get-canvas-context/issues"},"gitHead":"3bcb102575826167b9d0601516eb38c915f9d6b5","_id":"get-canvas-context@1.0.1","_shasum":"50258d881f6e6950134d36cd8001032cd0500b5b","_from":".","_npmVersion":"2.1.18","_nodeVersion":"0.10.32","_npmUser":{"name":"mattdesl","email":"dave.des@gmail.com"},"dist":{"shasum":"50258d881f6e6950134d36cd8001032cd0500b5b","tarball":"http://registry-npm.ywwl.com/get-canvas-context/download/get-canvas-context-1.0.1.tgz","integrity":"sha512-VUpFdFHZ1dI69PYyKrsOlzLWswSSrYkJWJby5IfwkTyV9tRj4ywuIvr0g1O8W/5hRrc1ocUGHMU4I8HbvB7nuw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHrp0gg510LC5ro1qsud7SFRAkEU66V4PTD9q5pNijNTAiEA8p3fX7r6nbYaskxpS+2S/eDACRLxhzt/pHPxXBdeRiE="}],"size":2421,"noattachment":false,"key":"/get-canvas-context/-/get-canvas-context-1.0.1.tgz"},"maintainers":[{"name":"mattdesl","email":"dave.des@gmail.com"}],"directories":{},"readme":"# get-canvas-context\n\n[![stable](http://badges.github.io/stability-badges/dist/stable.svg)](http://github.com/badges/stability-badges)\n\nCreates a new HTML5 Canvas Context with the given dimensions and options. Returns `null` if not supported.\n\nSupports `'webgl'`, `'webgl2'` and `'2d'`, handles vendor prefixing, and runs in Node and the Browser.\n\n## Install\n\n```sh\nnpm install get-canvas-context --save\n```\n\n## Example\n\n```js\nvar getContext = require('get-canvas-context')\n\n// create a new 50x50 2D canvas\nvar ctx = getContext('2d', {\n  width: 50,\n  height: 50\n})\n\n// add to DOM\ndocument.body.appendChild(ctx.canvas)\n\n// draw to it\nctx.fillRect(0, 0, 50, 50)\n```\n\nOr, WebGL using an existing canvas:\n\n```js\nvar canvas = document.createElement('canvas')\n\nvar gl = getContext('webgl', {\n  canvas: canvas,\n  antialias: true\n})\n\nif (!gl) {\n  throw new Error('webgl not supported')\n}\n```\n\n## Usage\n\n[![NPM](https://nodei.co/npm/get-canvas-context.png)](https://www.npmjs.com/package/get-canvas-context)\n\n#### `ctx = createContext(type, [opt])`\n\nReturns a new canvas context for the given `type`, a string which is either `'2d'`, `'webgl'` or `'webgl2'`. The options:\n\n- `canvas` - an existing canvas element to re-use rather than creating a new one\n- `width` - if specified, will set the canvas width\n- `height` - if specified, will set the canvas height\n- `{...contextAttributes}` any other options for the rendering context, like `alpha`\n\nHandles vendor prefixing for WebGL contexts. Returns `null` if we are not in a browser, or if the context is not available, or if there was an error creating the context.\n\n**Note:** As of the time of writing (Jun 2015), `\"webgl2\"` is only supported through special flags in Chrome Canary and FireFox Nightly.\n\n## License\n\nMIT, see [LICENSE.md](http://github.com/Jam3/get-canvas-context/blob/master/LICENSE.md) for details.\n","publish_time":1434045209424,"_cnpm_publish_time":1434045209424,"dist-tags":{"latest":"1.0.2"}}