{"versions":{"1.0.0":{"name":"canvas-app","version":"1.0.0","description":"sets up a retina-scaled canvas with render loop","main":"index.js","license":"MIT","author":{"name":"Matt DesLauriers","email":"dave.des@gmail.com"},"dependencies":{"webgl-context":"^1.2.1"},"devDependencies":{"tape":"~2.13.2"},"scripts":{"test":"tape test.js"},"testling":{"files":"test.js","browsers":["ie/6..latest","chrome/22..latest","firefox/16..latest","safari/latest","opera/11.0..latest","iphone/6","ipad/6","android-browser/latest"]},"repository":{"type":"git","url":"git://github.com/mattdesl/canvas-app.git"},"homepage":"https://github.com/mattdesl/canvas-app","bugs":{"url":"https://github.com/mattdesl/canvas-app/issues"},"keywords":["canvas","2d","webgl","gl","context","context2d","render","renderer","loop","frame","game","shell","animation"],"gitHead":"4b5e5d9a2909e62a9069e7ad48669381f06425ff","_id":"canvas-app@1.0.0","_shasum":"3d5313b07bce1d6abdccb278875a893627664bec","_from":".","_npmVersion":"1.4.14","_npmUser":{"name":"anonymous","email":"dave.des@gmail.com"},"maintainers":[{"name":"anonymous","email":"dave.des@gmail.com"}],"dist":{"shasum":"3d5313b07bce1d6abdccb278875a893627664bec","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/canvas-app/-/canvas-app-1.0.0.tgz","size":3688,"integrity":"sha512-ipKAyEa4cf64MqFylmTaEHsEloIKJY04UY5ERd5bGhrr+amcJ6IlAF9abAVC6XY8QoWx+t7s9Go9bWxUgJc5fg=="},"deprecated":"use","directories":{},"_cnpmcore_publish_time":"2021-12-23T07:48:28.454Z","contributors":[]},"1.1.0":{"name":"canvas-app","version":"1.1.0","description":"sets up a retina-scaled canvas with render loop","main":"index.js","license":"MIT","author":{"name":"Matt DesLauriers","email":"dave.des@gmail.com"},"dependencies":{"webgl-context":"^1.2.1"},"devDependencies":{"domready":"^1.0.5","tape":"~2.13.2"},"scripts":{"test":"tape test.js"},"testling":{"files":"test.js","browsers":["ie/6..latest","chrome/22..latest","firefox/16..latest","safari/latest","opera/11.0..latest","iphone/6","ipad/6","android-browser/latest"]},"repository":{"type":"git","url":"git://github.com/mattdesl/canvas-app.git"},"homepage":"https://github.com/mattdesl/canvas-app","bugs":{"url":"https://github.com/mattdesl/canvas-app/issues"},"keywords":["canvas","2d","webgl","gl","context","context2d","render","renderer","loop","frame","game","shell","animation"],"gitHead":"22b7ebdb089f6234bc0d638426ea33fdc5975912","_id":"canvas-app@1.1.0","_shasum":"70670b643db755bee9f178fed32706e75e2dbb36","_from":".","_npmVersion":"1.4.14","_npmUser":{"name":"anonymous","email":"dave.des@gmail.com"},"maintainers":[{"name":"anonymous","email":"dave.des@gmail.com"}],"dist":{"shasum":"70670b643db755bee9f178fed32706e75e2dbb36","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/canvas-app/-/canvas-app-1.1.0.tgz","size":4060,"integrity":"sha512-BGkfYMoB0FXELFhUwR8S0OiIpEiH5VMMqOiWOxJh2Mfk1E708eChqcTSKyoirt+USSm3gg9mjOdjpICD0FsQJA=="},"deprecated":"use","directories":{},"_cnpmcore_publish_time":"2021-12-23T07:48:29.331Z","contributors":[]},"2.0.0":{"name":"canvas-app","version":"2.0.0","description":"sets up a retina-scaled canvas with render loop","main":"index.js","license":"MIT","author":{"name":"Matt DesLauriers","email":"dave.des@gmail.com"},"dependencies":{"webgl-context":"^1.2.1"},"devDependencies":{"domready":"^1.0.5","tape":"~2.13.2"},"scripts":{"test":"tape test.js"},"testling":{"files":"test.js","browsers":["ie/6..latest","chrome/22..latest","firefox/16..latest","safari/latest","opera/11.0..latest","iphone/6","ipad/6","android-browser/latest"]},"repository":{"type":"git","url":"git://github.com/mattdesl/canvas-app.git"},"homepage":"https://github.com/mattdesl/canvas-app","bugs":{"url":"https://github.com/mattdesl/canvas-app/issues"},"keywords":["canvas","2d","webgl","gl","context","context2d","render","renderer","loop","frame","game","shell","animation"],"gitHead":"c367bdbebf1394611de0cc6dfa8aa26812840f81","_id":"canvas-app@2.0.0","_shasum":"c307e947eb0be9225c204bd581907feec9a23768","_from":".","_npmVersion":"1.4.14","_npmUser":{"name":"anonymous","email":"dave.des@gmail.com"},"maintainers":[{"name":"anonymous","email":"dave.des@gmail.com"}],"dist":{"shasum":"c307e947eb0be9225c204bd581907feec9a23768","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/canvas-app/-/canvas-app-2.0.0.tgz","size":4177,"integrity":"sha512-fMiRwPEev2TSGxgF6qILP9bcaBIQQco/UD48ieZPnDNRsMxjNceRuffGdAc7JC0ztYO3Gd4BH6a9CbsMX7OcIQ=="},"deprecated":"use","directories":{},"_cnpmcore_publish_time":"2021-12-23T07:48:30.220Z","contributors":[]},"2.1.0":{"name":"canvas-app","version":"2.1.0","description":"sets up a retina-scaled canvas with render loop","main":"index.js","license":"MIT","author":{"name":"Matt DesLauriers","email":"dave.des@gmail.com"},"dependencies":{"add-event-listener":"0.0.1","debounce":"^1.0.0","webgl-context":"^1.2.1"},"devDependencies":{"domready":"^1.0.5","tape":"~2.13.2"},"scripts":{"test":"tape test.js"},"testling":{"files":"test.js","browsers":["ie/6..latest","chrome/22..latest","firefox/16..latest","safari/latest","opera/11.0..latest","iphone/6","ipad/6","android-browser/latest"]},"repository":{"type":"git","url":"git://github.com/mattdesl/canvas-app.git"},"homepage":"https://github.com/mattdesl/canvas-app","bugs":{"url":"https://github.com/mattdesl/canvas-app/issues"},"keywords":["canvas","2d","webgl","gl","context","context2d","render","renderer","loop","frame","game","shell","animation"],"gitHead":"e63ff42715bf71a09fe08a2030917cd2f66e1889","_id":"canvas-app@2.1.0","_shasum":"cf3980a5d1b88984c0642f5d516941547f1b1fba","_from":".","_npmVersion":"1.4.14","_npmUser":{"name":"anonymous","email":"dave.des@gmail.com"},"maintainers":[{"name":"anonymous","email":"dave.des@gmail.com"}],"dist":{"shasum":"cf3980a5d1b88984c0642f5d516941547f1b1fba","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/canvas-app/-/canvas-app-2.1.0.tgz","size":4259,"integrity":"sha512-TPJEHgmG8DKRv6j3giC3DQkUm1ledjhW67X18fkP+toYB56tsr5gpiY24MJhCjDI7BjIfX7g34WoCFCt5K4Aaw=="},"deprecated":"use","directories":{},"_cnpmcore_publish_time":"2021-12-23T07:48:31.076Z","contributors":[]},"2.1.1":{"name":"canvas-app","version":"2.1.1","description":"sets up a retina-scaled canvas with render loop","main":"index.js","license":"MIT","author":{"name":"Matt DesLauriers","email":"dave.des@gmail.com"},"dependencies":{"add-event-listener":"0.0.1","debounce":"^1.0.0","webgl-context":"^1.2.1"},"devDependencies":{"domready":"^1.0.5","tape":"~2.13.2"},"scripts":{"test":"tape test.js"},"testling":{"files":"test.js","browsers":["ie/6..latest","chrome/22..latest","firefox/16..latest","safari/latest","opera/11.0..latest","iphone/6","ipad/6","android-browser/latest"]},"repository":{"type":"git","url":"git://github.com/mattdesl/canvas-app.git"},"homepage":"https://github.com/mattdesl/canvas-app","bugs":{"url":"https://github.com/mattdesl/canvas-app/issues"},"keywords":["canvas","2d","webgl","gl","context","context2d","render","renderer","loop","frame","game","shell","animation"],"gitHead":"b16eea5165abc830043203a0f6706c2151d9c62b","_id":"canvas-app@2.1.1","_shasum":"0c172e5130a049d5e3bebda0b7a3e103ac6d3d2b","_from":".","_npmVersion":"1.4.14","_npmUser":{"name":"anonymous","email":"dave.des@gmail.com"},"maintainers":[{"name":"anonymous","email":"dave.des@gmail.com"}],"dist":{"shasum":"0c172e5130a049d5e3bebda0b7a3e103ac6d3d2b","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/canvas-app/-/canvas-app-2.1.1.tgz","size":4320,"integrity":"sha512-Ng03kObA+dxVd7ZsX8oRuMKHjx618Zv61taK2RvQpwERm4iDjksK5cGjNapLaQKhC1qs5RzhiZsS2/UCRhw7Vg=="},"deprecated":"use","directories":{},"_cnpmcore_publish_time":"2021-12-23T07:48:31.947Z","contributors":[]},"2.2.0":{"name":"canvas-app","version":"2.2.0","description":"sets up a retina-scaled canvas with render loop","main":"index.js","license":"MIT","author":{"name":"Matt DesLauriers","email":"dave.des@gmail.com"},"dependencies":{"add-event-listener":"0.0.1","debounce":"^1.0.0","is-webgl-context":"^1.0.0","webgl-context":"^1.2.1"},"devDependencies":{"domready":"^1.0.5","gl-clear":"0.0.1","tape":"~2.13.2","webgl-context":"^1.2.1"},"scripts":{"test":"tape test.js"},"testling":{"files":"test.js","browsers":["ie/6..latest","chrome/22..latest","firefox/16..latest","safari/latest","opera/11.0..latest","iphone/6","ipad/6","android-browser/latest"]},"repository":{"type":"git","url":"git://github.com/mattdesl/canvas-app.git"},"homepage":"https://github.com/mattdesl/canvas-app","bugs":{"url":"https://github.com/mattdesl/canvas-app/issues"},"keywords":["canvas","2d","webgl","gl","context","context2d","render","renderer","loop","frame","game","shell","animation"],"gitHead":"44cbff9e3a0a72df2ba4330e420549ff72c001ba","_id":"canvas-app@2.2.0","_shasum":"25e4e321adeeb0a66b595445969c8d91740652bb","_from":".","_npmVersion":"1.4.14","_npmUser":{"name":"anonymous","email":"dave.des@gmail.com"},"maintainers":[{"name":"anonymous","email":"dave.des@gmail.com"}],"dist":{"shasum":"25e4e321adeeb0a66b595445969c8d91740652bb","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/canvas-app/-/canvas-app-2.2.0.tgz","size":4777,"integrity":"sha512-YuhpWgiGJcI145kFD7MwMiURQg06c1ewNvLZpZ7QsLWNWPDMiRJqh14nYv0kCeiUlkfewRpTeY7WFygeUB2a8Q=="},"deprecated":"use","directories":{},"_cnpmcore_publish_time":"2021-12-23T07:48:32.822Z","contributors":[]},"2.3.0":{"name":"canvas-app","version":"2.3.0","description":"sets up a retina-scaled canvas with render loop","main":"index.js","license":"MIT","author":{"name":"Matt DesLauriers","email":"dave.des@gmail.com"},"dependencies":{"add-event-listener":"0.0.1","debounce":"^1.0.0","is-webgl-context":"^1.0.0","webgl-context":"^1.2.1"},"devDependencies":{"domready":"^1.0.5","gl-clear":"0.0.1","tape":"~2.13.2","webgl-context":"^1.2.1"},"scripts":{"test":"tape test.js"},"testling":{"files":"test.js","browsers":["ie/6..latest","chrome/22..latest","firefox/16..latest","safari/latest","opera/11.0..latest","iphone/6","ipad/6","android-browser/latest"]},"repository":{"type":"git","url":"git://github.com/mattdesl/canvas-app.git"},"homepage":"https://github.com/mattdesl/canvas-app","bugs":{"url":"https://github.com/mattdesl/canvas-app/issues"},"keywords":["canvas","2d","webgl","gl","context","context2d","render","renderer","loop","frame","game","shell","animation"],"gitHead":"0754f3a6d39bdeb481d5a6d28b844c834939be9a","_id":"canvas-app@2.3.0","_shasum":"ecae72739cbf44f97785e33f9bc2408c770463e0","_from":".","_npmVersion":"1.4.14","_npmUser":{"name":"anonymous","email":"dave.des@gmail.com"},"maintainers":[{"name":"anonymous","email":"dave.des@gmail.com"}],"dist":{"shasum":"ecae72739cbf44f97785e33f9bc2408c770463e0","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/canvas-app/-/canvas-app-2.3.0.tgz","size":4858,"integrity":"sha512-ivAc8TKUvhm7sa4IWOPNR12cFwrafImPfuBgDkx9bTKPMgPwxC413fzp+T8rY0lUO3EFt7MpYEeOFq7KuGcOMg=="},"deprecated":"use","directories":{},"_cnpmcore_publish_time":"2021-12-23T07:48:33.701Z","contributors":[]},"2.4.0":{"name":"canvas-app","version":"2.4.0","description":"sets up a retina-scaled canvas with render loop","main":"index.js","license":"MIT","author":{"name":"Matt DesLauriers","email":"dave.des@gmail.com"},"dependencies":{"add-event-listener":"0.0.1","debounce":"^1.0.0","is-webgl-context":"^1.0.0","webgl-context":"^1.2.1"},"devDependencies":{"domready":"^1.0.5","gl-clear":"0.0.1","tape":"~2.13.2","webgl-context":"^1.2.1"},"scripts":{"test":"tape test.js"},"testling":{"files":"test.js","browsers":["ie/6..latest","chrome/22..latest","firefox/16..latest","safari/latest","opera/11.0..latest","iphone/6","ipad/6","android-browser/latest"]},"repository":{"type":"git","url":"git://github.com/mattdesl/canvas-app.git"},"homepage":"https://github.com/mattdesl/canvas-app","bugs":{"url":"https://github.com/mattdesl/canvas-app/issues"},"keywords":["canvas","2d","webgl","gl","context","context2d","render","renderer","loop","frame","game","shell","animation"],"gitHead":"303c982ab957c1d8dd5856e0310f5b70233875b1","_id":"canvas-app@2.4.0","_shasum":"b6b84fc09be4f6ad14fcae8ad7888283381e5e87","_from":".","_npmVersion":"2.1.4","_nodeVersion":"0.10.32","_npmUser":{"name":"anonymous","email":"dave.des@gmail.com"},"maintainers":[{"name":"anonymous","email":"dave.des@gmail.com"}],"dist":{"shasum":"b6b84fc09be4f6ad14fcae8ad7888283381e5e87","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/canvas-app/-/canvas-app-2.4.0.tgz","size":4890,"integrity":"sha512-2q2y5NTvp5vfrp2H/dcz1T2MJQvy4KwfiZYgvUuLNq8+fRcX3rH2bBfLKggs49onaclGEdv/R1qNtYoHMLKvFA=="},"deprecated":"use","directories":{},"_cnpmcore_publish_time":"2021-12-23T07:48:34.589Z","contributors":[]},"2.4.1":{"name":"canvas-app","version":"2.4.1","description":"sets up a retina-scaled canvas with render loop","main":"index.js","license":"MIT","author":{"name":"Matt DesLauriers","email":"dave.des@gmail.com"},"dependencies":{"add-event-listener":"0.0.1","debounce":"^1.0.0","is-webgl-context":"^1.0.0","webgl-context":"^1.2.1"},"devDependencies":{"domready":"^1.0.5","gl-clear":"0.0.1","tape":"~2.13.2","webgl-context":"^1.2.1"},"scripts":{"test":"tape test.js"},"testling":{"files":"test.js","browsers":["ie/6..latest","chrome/22..latest","firefox/16..latest","safari/latest","opera/11.0..latest","iphone/6","ipad/6","android-browser/latest"]},"repository":{"type":"git","url":"git://github.com/mattdesl/canvas-app.git"},"homepage":"https://github.com/mattdesl/canvas-app","bugs":{"url":"https://github.com/mattdesl/canvas-app/issues"},"keywords":["canvas","2d","webgl","gl","context","context2d","render","renderer","loop","frame","game","shell","animation"],"gitHead":"bd54db16d20e9549d4f922592bfff44f6623936c","_id":"canvas-app@2.4.1","_shasum":"493cdbd808cd62de9def6f4fd181592da9a7e5f4","_from":".","_npmVersion":"2.1.18","_nodeVersion":"0.10.32","_npmUser":{"name":"anonymous","email":"dave.des@gmail.com"},"dist":{"shasum":"493cdbd808cd62de9def6f4fd181592da9a7e5f4","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/canvas-app/-/canvas-app-2.4.1.tgz","size":5012,"integrity":"sha512-Rxke8In2ZznSUpxDc5VSoN7lYtHcw9Wy4N5e73Q4s5N5n9D2EaaYQLc9/0UYmcghXIc+dj1JIy8XCmwvQnsbqQ=="},"maintainers":[{"name":"anonymous","email":"dave.des@gmail.com"}],"directories":{},"_cnpmcore_publish_time":"2021-12-23T07:48:34.684Z","contributors":[]}},"dist-tags":{"latest":"2.4.1"},"name":"canvas-app","time":{"created":"2022-01-27T01:04:56.091Z","modified":"2022-01-27T01:04:56.091Z","1.0.0":"2014-07-06T16:43:22.481Z","1.1.0":"2014-07-09T14:15:47.976Z","2.0.0":"2014-09-27T19:54:03.164Z","2.1.0":"2014-10-01T00:50:12.563Z","2.1.1":"2014-10-01T00:52:03.286Z","2.2.0":"2014-10-05T20:01:38.597Z","2.3.0":"2014-10-14T14:06:43.890Z","2.4.0":"2014-11-15T04:41:41.446Z","2.4.1":"2015-05-09T20:09:05.163Z"},"readme":"# canvas-app\n\n[![stable](http://badges.github.io/stability-badges/dist/stable.svg)](http://github.com/badges/stability-badges)\n\n#### deprecation warning\n\nThis module is bloated and a little too magical. Instead, some of the following are recommended:\n\n- [canvas-fit-loop](https://www.npmjs.com/package/canvas-fit-loop)\n- [2d-context](https://www.npmjs.com/package/2d-context)\n- [webgl-context](https://www.npmjs.com/package/webgl-context)\n\n---\n\nThe Easy Bake Oven of canvas rendering. Sets up a canvas for 2D or WebGL context, handling a few things like:\n\n- CSS scaling for retina displays with a devicePixelRatio of > 1.0\n- Boilerplate to safely grab 2D/webgl context\n- resizes the canvas to full-screen on resize & device orientation change (by default)\n- basic delta time calculation\n- start/stop handling\n- current FPS\n\nSimplest use might look like this:\n\n```js\n//a simple render loop\nfunction render(context, width, height, dt) {\n\tcontext.clearRect(0, 0, width, height);\n\tcontext.fillRect(20, 50, 25, 25);\n\n\tcontext.fillText(\"FPS: \"+this.fps, 20, 20);\n}\n\n//defaults to a full-screen canvas\nvar app = require('canvas-app')(render);\n\n//append to DOM\ndocument.body.appendChild( app.canvas );\n\n//start render loop\napp.start();\n```\n\nFor simple use like the above, you may want to use [canvas-testbed](https://github.com/mattdesl/canvas-testbed), which also handles DOM ready event, better body styling for full-screen canvas apps, and requestAnimationFrame polyfills.\n\n## Usage\n\n[![NPM](https://nodei.co/npm/canvas-app.png)](https://nodei.co/npm/canvas-app/)\n\nAnother example:\n\n```js\nvar app = require('canvas-app')(renderHandler, {\n\twidth: 256,\n\theight: 256,\n\tonce: true, //only render once\n\tretina: false, //don't try to scale for retina displays\n});\n\n//renders a single frame\napp.renderOnce();\n```\n\nThe constructor can take two forms:\n\n```js\ncanvasApp(renderHandler, options);\ncanvasApp(options);\n```\n\n### options\n\n- `width` force a width of the canvas in pixels. If passed, resize events will be ignored\n- `height` force a height of the canvas in pixels. If passed, resize events will be ignored\n- `ignoreResize` if true, resize events will be ignored\n- `retina` default true, whether to scale the canvas style and context for device pixel ratio\n- `once` only renders a single frame, and then again on resize\n- `canvas` the canvas element to use, otherwise creates a new element\n- `context` the context to use, can be either 'webgl' or '2d', defaults to 2d\n- `contextAttributes` passed to the getContext call\n- `onResize` a function called on resize with arguments `width, height`\n- `onRender` a function called on render with arguments `context, width, height, deltaTime` (can instead be passed as first argument to the constructor)\n- `resizeDebounce` if we are using built-in resize handlers, they will be debounced by 50 ms unless you specify a value explicitly here\n\nIf `context is a WebGLRenderingContext or CanvasRenderingContext, it will be used along with its associated `canvas`. This is useful to avoid consecutive `getContext('webgl')` calls which can interfere with WebGL inspectors. \n\n### methods\n\n- `renderOnce()` renders a single frame\n- `start()` starts the render loop\n- `stop()` stops the current render loop\n- `resize(width, height)` resizes the canvas to the given size. You should probably use `ignoreResize` if you want to manually handle resize events.\n\n### properties\n\n- `canvas` the canvas element\n- `context` the 2D or WebGL rendering context\n- `width`, `height` the current size, not scaled by devicePixelRatio\n- `running` whether the loop is currently running\n- `deviceWidth`, `deviceHeight` the actual device height (i.e. size * devicePixelRatio). This is needed for glViewport, glScissor, etc.\n\n### context scaling / viewport\n\nFor 2D contexts, `scale()` is called before rendering based on the deviePixelRatio. For WebGL contexts, `gl.viewport()` is called before rendering with the device size. \n\nIf `retina` is false, the device size will be assumed to be the same as the canvas size. \n\n## License\n\nMIT, see [LICENSE.md](http://github.com/mattdesl/canvas-app/blob/master/LICENSE.md) for details.","users":{}}