{"_id":"@dermah/pulsar-detector-p5","_rev":"4-775d5e4be204a11406bfbcf5f2cc546f","name":"@dermah/pulsar-detector-p5","description":"Detect pulses and render them with p5.js","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@dermah/pulsar-detector-p5","version":"0.1.0","description":"Detect pulses and render them with p5.js","main":"lib/index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"webpack src/pulsar.js lib/index.js --module-bind json","watch":"npm run build -- --watch","prepublish":"npm run build"},"repository":{"type":"git","url":"git+https://github.com/Dermah/pulsar-detector-p5.git"},"keywords":["pulsar","p5","processing"],"author":{"name":"Dermah"},"license":"MIT","bugs":{"url":"https://github.com/Dermah/pulsar-detector-p5/issues"},"homepage":"https://github.com/Dermah/pulsar-detector-p5#readme","dependencies":{"json-loader":"^0.5.2","node-libs-browser":"^0.5.2","p5":"^0.4.4","socket.io-client":"^1.3.5","webpack":"^1.9.10"},"files":["lib/index.js"],"gitHead":"5fcea91617975be6972dbd3c575e787a8637cf75","_id":"@dermah/pulsar-detector-p5@0.1.0","_shasum":"88c7e7063460aef291ec1e5594bafc02309ecd8b","_from":".","_npmVersion":"3.9.3","_nodeVersion":"6.2.1","_npmUser":{"name":"dermah","email":"inquiry@dermah.com"},"dist":{"shasum":"88c7e7063460aef291ec1e5594bafc02309ecd8b","tarball":"https://registry.npmjs.org/@dermah/pulsar-detector-p5/-/pulsar-detector-p5-0.1.0.tgz","integrity":"sha512-URYPLGMo76GVZaSV9y07vhA5GzEM4QXgjdOmof3Ny8KTLCtYgeBdB9VwN9TZcbdg86lve1J30t7bjdXj2ddeiw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDPUy1m5PmPPl1SlemfSj+rPtAYUKZBO4NI84Cp03FQUAiBL0lfq9EvgDi3oZfaYxfPiFK4rif8y2YFbLZ0IgOKcdA=="}]},"maintainers":[{"name":"dermah","email":"inquiry@dermah.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/pulsar-detector-p5-0.1.0.tgz_1466951530425_0.534805472008884"}},"0.1.1":{"name":"@dermah/pulsar-detector-p5","version":"0.1.1","description":"Detect pulses and render them with p5.js","main":"lib/index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"webpack src/pulsar.js lib/index.js --module-bind json","watch":"npm run build -- --watch","prepublish":"npm run build -- --optimize-minimize --optimize-dedupe"},"repository":{"type":"git","url":"git+https://github.com/Dermah/pulsar-detector-p5.git"},"keywords":["pulsar","p5","processing"],"author":{"name":"Dermah"},"license":"MIT","bugs":{"url":"https://github.com/Dermah/pulsar-detector-p5/issues"},"homepage":"https://github.com/Dermah/pulsar-detector-p5#readme","dependencies":{"json-loader":"^0.5.2","node-libs-browser":"^0.5.2","p5":"^0.4.4","socket.io-client":"^1.3.5","webpack":"^1.9.10"},"files":["lib/index.js"],"gitHead":"a90f0983ff3efda7ebd87741e296a1b1e799293c","_id":"@dermah/pulsar-detector-p5@0.1.1","_shasum":"3e06abe11de5e3b11aaebc852087cd44d7ee69c4","_from":".","_npmVersion":"3.9.3","_nodeVersion":"6.2.1","_npmUser":{"name":"dermah","email":"inquiry@dermah.com"},"dist":{"shasum":"3e06abe11de5e3b11aaebc852087cd44d7ee69c4","tarball":"https://registry.npmjs.org/@dermah/pulsar-detector-p5/-/pulsar-detector-p5-0.1.1.tgz","integrity":"sha512-/g7uZERRRXwdzKBsqXu4cCMdtX8w+YI1rsfHk3t+7GoY9Hvb91ILcC1ezk7Gk6q7Bmhzvt8ti5uPcBs7ai0opQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGOzrHxRfWjdKnKbJ7LV+3npK8k0wQ/wW9BB5cgQ+fg0AiEAo0HXm02SLbAvGyS3HXLwpeRcqrarLicu3ScQNb+jN0Y="}]},"maintainers":[{"name":"dermah","email":"inquiry@dermah.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/pulsar-detector-p5-0.1.1.tgz_1466953499934_0.5910214395262301"}}},"readme":"# pulsar-detector-p5\nDetect [pulses](https://github.com/Dermah/pulsar) and render them with [p5.js](http://p5js.org/)\n\n## Install\n\nClone this repo then\n\n    npm install\n\n## Build\n\n    npm run build\n\nThis uses `webpack` to bundle all the PULSAR client-side drawing code into `dist/pulsar.js` which is served up by the web server later. You can also do\n\n    npm run watch\n\nto automatically build everything when you make a change\n\n## Run\n\nThe file generated at `lib/index.js` should be run in a browser. If you served it to a browser as `pulsar.js`, put this in the html.\n\n```html\n<script src=\"pulsar.js\"></script>\n```\n\n[p5](http://p5js.org/) will insert a `canvas` tag on the page, start receiving [pulses](https://github.com/Dermah/pulsar) from the server and draw its detections. \n\n## Make your own drawings\n\nMaking your own drawings is a bit like making a [p5.js](http://p5js.org/)/[Processing](https://processing.org/) sketch. There is a setup function (called when the drawing is activated initially), and a draw function (called every frame). Additionally, PULSAR drawings expose another function that indicate whether or not they have finished drawing, allowing the whole drawing to be garbage collected.\n\nTo make your own drawings, you need to build an object with prototype like this:\n\n```JavaScript\n// This prototype must be saved at src/pulses/name-of-drawing.js\nvar Drawing = function (p5, pulse, config) {\n  this.pulse = pulse;\n  // The pulse object contains information to customise the drawing.\n  // You should mere it with some defaults\n  // This drawing will only be used if pulse.name === name-of-drawing\n  // Do your setup stuff here. For example, set up a frame counter to\n  // track how many frames this has been run for.\n  this.framesLeft = 50;\n};\nDrawing.prototype.draw = function (p5) {\n  // This function is called every frame.\n  // Do all your frame by frame drawing using the p5 object here.\n  // If you wanted to draw a rectangle in the middle of the screen\n  // you would do the following:\n  p5.rect(p5.windowWidth/2, p5.windowHeight/2, 50, 50);\n  this.framesLeft--;\n};\nDrawing.prototype.done = function () {\n  // Return true if this drawing is finished. It will then be cleaned up by\n  // the drawing manager. Otherwise return false if you want to keep drawing frames\n  if (this.framesLeft <= 0) {\n    return true;\n  } else {\n    return false;\n  }\n}\nmodule.exports = Drawing;\n```\nIf you want your drawing to be updatable, add an update function. Usually you would merge the original `pulse` object that created the drawing with the update `pulse`. PULSAR provides a function on the p5 object to do this easily.\n\n```JavaScript\nDrawing.prototype.update = function (p5, pulse, config) {\n  p5.pulsar.merge(this.pulse, pulse);\n}\n```\n\nPlace your drawing in the `src/pulses/` directory.\n\nThen, to have the drawing activated on client machines, get `lib/transmitter/key-processor.js` to emit a `pulsar` `io` event when you press a key on the keyboard.\n\n```JavaScript\nio.emit('pulse', {\n  name: 'name-of-drawing',\n  // Other configuration options here.\n  // This whole object is passed to the\n  // drawing constructor\n});\n```\n","maintainers":[{"name":"dermah","email":"inquiry@dermah.com"}],"time":{"modified":"2022-06-12T17:01:11.878Z","created":"2016-06-26T14:32:14.730Z","0.1.0":"2016-06-26T14:32:14.730Z","0.1.1":"2016-06-26T15:05:04.279Z"},"homepage":"https://github.com/Dermah/pulsar-detector-p5#readme","keywords":["pulsar","p5","processing"],"repository":{"type":"git","url":"git+https://github.com/Dermah/pulsar-detector-p5.git"},"author":{"name":"Dermah"},"bugs":{"url":"https://github.com/Dermah/pulsar-detector-p5/issues"},"license":"MIT","readmeFilename":"README.md"}