{"name":"poem-loop","version":"1.0.1","description":"A requestAnimationFrame loop for visualizations, demos, experiments, art, and poems.","main":"lib/loop.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"https://github.com/tatumcreative/poem-loop/"},"keywords":["requestAnimationFrame","visualizations","games","art","poems","loop","game loop"],"author":{"name":"Greg Tatum"},"license":"MIT","dependencies":{"events":"^1.0.2","lodash":"^2.4.1","raf":"^2.0.4"},"gitHead":"10d18f5fbc22bd620ccf313e7abc990ae662125f","_id":"poem-loop@1.0.1","_shasum":"87bd4be29368c934e420c46e137943a662bf9d61","_from":".","_npmVersion":"2.1.18","_nodeVersion":"0.10.30","_npmUser":{"name":"tatumcreative","email":"tatum.creative@gmail.com"},"maintainers":[{"name":"tatumcreative","email":"tatum.creative@gmail.com"}],"dist":{"shasum":"87bd4be29368c934e420c46e137943a662bf9d61","tarball":"http://registry-npm.ywwl.com/poem-loop/download/poem-loop-1.0.1.tgz","integrity":"sha512-7ZCy9slnkUS7bvBp9alu9c0yy537bl5f0Lv8GR4L3Z25IRp6CD9Z/ZuVHp/nBUTYt/pkaAjQnyK1M+ajC3WPcw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDmLzcuyDn/Ex2mbRz4cym2oHY/pBIAAOqBQAnIZTUKZAIga1Hc+FG9XmG8u6esFL1vz7ZAJ/Ncd1dJZ1p8Cb563vo="}],"size":2727,"noattachment":false,"key":"/poem-loop/-/poem-loop-1.0.1.tgz"},"directories":{},"readme":"# poem-loop\n\nThis module is a configurable event loop for visualizations, demos, experiments, art, and poems. It provides an `update` and `draw` event, as well as `updatedone` and `drawdone`. It uses the [raf](https://www.npmjs.com/package/raf) module for the requestAnimationFrame.\n\nPart of the [programming-poem](https://www.npmjs.com/browse/keyword/programming-poem) module series.\n\n## Usage\n\nIts primary intended use is with [Browserify](http://browserify.org/).\n\nFrom the command line:\n\n\tnpm install poem-loop --save\n\nThen in your code:\n\n\tvar loop = require('poem-loop')( configuration );\n\t\n\tloop.start();\n\t\n\tloop.emitter.on('update', function( e ) {\n\t\tbox.position.x += e.dt;\n\t\tgameClock.text( e.elapsed );\n\t});\n\t\n\tloop.emitter.on('draw', function( e ) {\n\t\trenderer.render();\n\t});\n\t\n## Event object\n\nThe event object has the following values.\n\n * `dt` - The change in time in milliseconds.\n * `unitDt` - The change in time as a unit interval (0-1). Assumes 1 is equal to 16.6666 milliseconds.\n * `now` - The current Date.now() in milliseconds.\n * `elapsed` - The elapsed game time in milliseconds, starts at 0. Does not increment when the loop is stopped.\n\n## Configuration\n\nThe loop can be configured.\n\n\tvar loop = require('poem-loop')({\n\t\temitter: poemEmitter,\n\t\tcustomizeEvent : function( event ) {\n\t\t\tevent.mousePosition = getMousePosition();\n\t\t\treturn event;\n\t\t}\n\t});\n\n#### `emitter`\n\nA node.js EventEmitter. If one is set, it is used by the loop. Otherwise a new EventEmitter is created.\n\n#### `customizeEvent`\n\nA function that customizes the event object that is passed to the update and draw event. It gets passed the object and should return the object.\n\n## Interface\n\n#### `loop.start()`\n\nStart the loop.\n\n#### `loop.stop()`\n\nStops the loop but doesn't reset the elapsed time.\n\n#### `loop.reset()`\n\nResets the elapsed time.\n\n#### `loop.emitter`\n\nThe event emitter.","publish_time":1420946232603,"_cnpm_publish_time":1420946232603,"dist-tags":{"latest":"1.1.1"}}