{"action":"created","comment":{"url":"https://api.github.com/repos/vurvco/dada-photo-booth/pulls/comments/172067084","pull_request_review_id":101021743,"id":172067084,"diff_hunk":"@@ -3,77 +3,101 @@ based on:\n  - Simple Image Glitching Processing - datamoshing.com | 2016\n  - a pixel sorting sketch from Jerome Martinez | 2017\n  */\n- \n+\n // output needs to be 1066 x 800\n- \n+\n+var capture;\n+var gif;\n var img;\n-var imgFileName = \"vera\";\n-var fileType = \"jpg\";\n+var imgFileName = 'vera';\n+var fileType = 'jpg';\n+\n+var START_FRAME = 15;\n+var END_FRAME = 115;\n+\n+const serverUrl = 'http://localhost:3000';\n+\n+const socketOptions = {\n+  transports: ['websocket'],\n+  'force new connection': true\n+};\n+const socket = io(serverUrl, socketOptions);\n \n-function preload() {\n+function preload () {\n   // load an image from our library to set the canvas createCanvas\n-  img = loadImage(imgFileName + \".\" + fileType);\n+  img = loadImage(imgFileName + '.' + fileType); // eslint-disable-line no-undef\n }\n \n-\n-function setup() {\n-  \n-  // use only numbers (not variables) for the createCanvas() command, Processing 3\n-  var canvas = createCanvas(img.width, img.height);\n-  canvas.parent(\"p5canvas\");\n+function setup () {\n+  var canvas = createCanvas(img.width, img.height); // eslint-disable-line no-undef\n+  canvas.parent('p5canvas');\n \n   // allows the viewer to recreateCanvas and update surface to image file dimensions\n   // surface.setResizable(true);\n   // surface.setSize(img.width, img.height);\n-  \n+\n+  // todo: tweak these settings\n+  capture = createCapture(VIDEO);\n+  capture.size(320, 240);\n+  capture.hide();\n+  setupGif();\n+\n   // load image onto surface\n-  image(img, 0, 0);\n+  // todo: fix the fact that `capture` hides the image\n+  image(capture, 0, 0); // eslint-disable-line no-undef\n \n   img.loadPixels();\n-  noStroke();\n- \n-   //set the speed at which rectangles are created; 1 frame = 1 rectangle\n-  frameRate(30000);\n+  noStroke(); // eslint-disable-line no-undef\n+\n+  // set the speed at which rectangles are created; 1 frame = 1 rectangle\n+  frameRate(30000); // eslint-disable-line no-undef\n }\n \n-function draw() {\n-  // ellipse(100, 100, 100,100);\n-  //\n-  var randx = random(0,width);\n-  var randy = random(0, height);\n-  var randc = img.get(randx, randy);\n-  \n-  var randx_offset = random(0,8);\n-  var randy_offset = random(0,8);\n-  \n-  /*var randh = random(5,7) + random(3,7);\n-  var randw = randh * random(4,8);\n-  var rands = random(2,5);*/\n-  \n-  //\n-  var randh = random(2,3) + random(2,6);\n-  var randw = randh * random(2,7);\n-  var rands = random(2,6);\n-  \n-  //\n-  fill(randc);\n-  rect(randx+randx_offset, randy+randy_offset, randw, rands);\n-  \n-  //apply a posterized filter effect to the colors being randomly generated\n+function draw () {\n+  var randomX = random(0, width);\n+  var randomY = random(0, height);\n+  var randomColor = img.get(randomX, randomY);\n+\n+  var randomXOffset = random(0, 8);\n+  var randomYOffset = random(0, 8);\n+\n+  var randomHeight = random(2, 3) + random(2, 6);\n+  var randomWidth = randomHeight * random(2, 7);\n+  var randomS = random(2, 6);\n+\n+  fill(randomColor);\n+  rect(randomX + randomXOffset, randomY + randomYOffset, randomWidth, randomS);\n+\n+  // apply a posterized filter effect to the colors being randomly generated\n   filter(POSTERIZE, 6);\n-  /*filter(POSTERIZE, random(19,21));\n-  filter(INVERT);*/\n-  \n-  console.log(frameCount);\n-\n-  // save frame 1500 - 3500 to a local folder \n-  // if (frameCount > 1500 && frameCount < 1800) {\n-  //   saveFrames(\"/Users/dezein/Desktop/dadab-images/f#####.gif\");\n-  // }\n-\n-  //after 3500 frames stop the sketch from running\n-  // if (frameCount == 3500) {\n-  //   exit();\n-  // }\n+  /*\n+  filter(POSTERIZE, random(19,21));\n+  filter(INVERT);\n+  */\n+\n+  if (frameCount > START_FRAME && frameCount < END_FRAME) {\n+    console.log(`saving frame #${frameCount}`);\n+    gif.addFrame(document.getElementById('defaultCanvas0'), {delay: 1, copy: true});\n+  }\n+\n+  if (frameCount === END_FRAME) {\n+    console.log('done');\n+    // remove();\n+    gif.render();\n+  }\n }\n \n+function setupGif () {\n+  gif = new GIF({\n+    workers: 2,\n+    quality: 40\n+  });\n+\n+  gif.on('finished', (blob) => {\n+    console.log('~~~downloading...');\n+    // Blob is sent to server, where it is saved as a gif\n+    socket.emit('save_gif', blob);\n+    socket.on('saved_gif_response', (res) => console.log(res)); // 'ok' or 'not ok'","path":"dadab/dadab.js","position":154,"original_position":154,"commit_id":"b04fa06c2404f92b2d3f51db48395f4c3006618e","original_commit_id":"b04fa06c2404f92b2d3f51db48395f4c3006618e","user":{"login":"chrisbodhi","id":4071697,"avatar_url":"https://avatars0.githubusercontent.com/u/4071697?v=4","gravatar_id":"","url":"https://api.github.com/users/chrisbodhi","html_url":"https://github.com/chrisbodhi","followers_url":"https://api.github.com/users/chrisbodhi/followers","following_url":"https://api.github.com/users/chrisbodhi/following{/other_user}","gists_url":"https://api.github.com/users/chrisbodhi/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisbodhi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisbodhi/subscriptions","organizations_url":"https://api.github.com/users/chrisbodhi/orgs","repos_url":"https://api.github.com/users/chrisbodhi/repos","events_url":"https://api.github.com/users/chrisbodhi/events{/privacy}","received_events_url":"https://api.github.com/users/chrisbodhi/received_events","type":"User","site_admin":false},"body":"It's at this point we could switch the p5 sketch back to the camera view. But that'll be part of another branch that's about gluing it all together.","created_at":"2018-03-04T22:19:03Z","updated_at":"2018-03-04T22:25:00Z","html_url":"https://github.com/vurvco/dada-photo-booth/pull/25#discussion_r172067084","pull_request_url":"https://api.github.com/repos/vurvco/dada-photo-booth/pulls/25","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/vurvco/dada-photo-booth/pulls/comments/172067084"},"html":{"href":"https://github.com/vurvco/dada-photo-booth/pull/25#discussion_r172067084"},"pull_request":{"href":"https://api.github.com/repos/vurvco/dada-photo-booth/pulls/25"}}},"pull_request":{"url":"https://api.github.com/repos/vurvco/dada-photo-booth/pulls/25","id":172744788,"html_url":"https://github.com/vurvco/dada-photo-booth/pull/25","diff_url":"https://github.com/vurvco/dada-photo-booth/pull/25.diff","patch_url":"https://github.com/vurvco/dada-photo-booth/pull/25.patch","issue_url":"https://api.github.com/repos/vurvco/dada-photo-booth/issues/25","number":25,"state":"open","locked":false,"title":"Make gif from canvas output","user":{"login":"chrisbodhi","id":4071697,"avatar_url":"https://avatars0.githubusercontent.com/u/4071697?v=4","gravatar_id":"","url":"https://api.github.com/users/chrisbodhi","html_url":"https://github.com/chrisbodhi","followers_url":"https://api.github.com/users/chrisbodhi/followers","following_url":"https://api.github.com/users/chrisbodhi/following{/other_user}","gists_url":"https://api.github.com/users/chrisbodhi/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisbodhi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisbodhi/subscriptions","organizations_url":"https://api.github.com/users/chrisbodhi/orgs","repos_url":"https://api.github.com/users/chrisbodhi/repos","events_url":"https://api.github.com/users/chrisbodhi/events{/privacy}","received_events_url":"https://api.github.com/users/chrisbodhi/received_events","type":"User","site_admin":false},"body":"Closes #13 and #24 \r\n\r\n@dezein I'm making some comments in the code about what I did so you can see it. I won't merge these changes to the `master` branch until later tonight or tomorrow evening. I hope it doesn't wreck what you've been doing!","created_at":"2018-03-04T22:11:29Z","updated_at":"2018-03-04T22:25:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8d077e6d50663564af31b634dff408f31a6ddd47","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/vurvco/dada-photo-booth/pulls/25/commits","review_comments_url":"https://api.github.com/repos/vurvco/dada-photo-booth/pulls/25/comments","review_comment_url":"https://api.github.com/repos/vurvco/dada-photo-booth/pulls/comments{/number}","comments_url":"https://api.github.com/repos/vurvco/dada-photo-booth/issues/25/comments","statuses_url":"https://api.github.com/repos/vurvco/dada-photo-booth/statuses/b04fa06c2404f92b2d3f51db48395f4c3006618e","head":{"label":"vurvco:13-make-gif-from-canvas","ref":"13-make-gif-from-canvas","sha":"b04fa06c2404f92b2d3f51db48395f4c3006618e","user":{"login":"vurvco","id":28368172,"avatar_url":"https://avatars2.githubusercontent.com/u/28368172?v=4","gravatar_id":"","url":"https://api.github.com/users/vurvco","html_url":"https://github.com/vurvco","followers_url":"https://api.github.com/users/vurvco/followers","following_url":"https://api.github.com/users/vurvco/following{/other_user}","gists_url":"https://api.github.com/users/vurvco/gists{/gist_id}","starred_url":"https://api.github.com/users/vurvco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vurvco/subscriptions","organizations_url":"https://api.github.com/users/vurvco/orgs","repos_url":"https://api.github.com/users/vurvco/repos","events_url":"https://api.github.com/users/vurvco/events{/privacy}","received_events_url":"https://api.github.com/users/vurvco/received_events","type":"Organization","site_admin":false},"repo":{"id":101830912,"name":"dada-photo-booth","full_name":"vurvco/dada-photo-booth","owner":{"login":"vurvco","id":28368172,"avatar_url":"https://avatars2.githubusercontent.com/u/28368172?v=4","gravatar_id":"","url":"https://api.github.com/users/vurvco","html_url":"https://github.com/vurvco","followers_url":"https://api.github.com/users/vurvco/followers","following_url":"https://api.github.com/users/vurvco/following{/other_user}","gists_url":"https://api.github.com/users/vurvco/gists{/gist_id}","starred_url":"https://api.github.com/users/vurvco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vurvco/subscriptions","organizations_url":"https://api.github.com/users/vurvco/orgs","repos_url":"https://api.github.com/users/vurvco/repos","events_url":"https://api.github.com/users/vurvco/events{/privacy}","received_events_url":"https://api.github.com/users/vurvco/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/vurvco/dada-photo-booth","description":"Containerized version of the Dada Photo Booth","fork":false,"url":"https://api.github.com/repos/vurvco/dada-photo-booth","forks_url":"https://api.github.com/repos/vurvco/dada-photo-booth/forks","keys_url":"https://api.github.com/repos/vurvco/dada-photo-booth/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vurvco/dada-photo-booth/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vurvco/dada-photo-booth/teams","hooks_url":"https://api.github.com/repos/vurvco/dada-photo-booth/hooks","issue_events_url":"https://api.github.com/repos/vurvco/dada-photo-booth/issues/events{/number}","events_url":"https://api.github.com/repos/vurvco/dada-photo-booth/events","assignees_url":"https://api.github.com/repos/vurvco/dada-photo-booth/assignees{/user}","branches_url":"https://api.github.com/repos/vurvco/dada-photo-booth/branches{/branch}","tags_url":"https://api.github.com/repos/vurvco/dada-photo-booth/tags","blobs_url":"https://api.github.com/repos/vurvco/dada-photo-booth/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vurvco/dada-photo-booth/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vurvco/dada-photo-booth/git/refs{/sha}","trees_url":"https://api.github.com/repos/vurvco/dada-photo-booth/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vurvco/dada-photo-booth/statuses/{sha}","languages_url":"https://api.github.com/repos/vurvco/dada-photo-booth/languages","stargazers_url":"https://api.github.com/repos/vurvco/dada-photo-booth/stargazers","contributors_url":"https://api.github.com/repos/vurvco/dada-photo-booth/contributors","subscribers_url":"https://api.github.com/repos/vurvco/dada-photo-booth/subscribers","subscription_url":"https://api.github.com/repos/vurvco/dada-photo-booth/subscription","commits_url":"https://api.github.com/repos/vurvco/dada-photo-booth/commits{/sha}","git_commits_url":"https://api.github.com/repos/vurvco/dada-photo-booth/git/commits{/sha}","comments_url":"https://api.github.com/repos/vurvco/dada-photo-booth/comments{/number}","issue_comment_url":"https://api.github.com/repos/vurvco/dada-photo-booth/issues/comments{/number}","contents_url":"https://api.github.com/repos/vurvco/dada-photo-booth/contents/{+path}","compare_url":"https://api.github.com/repos/vurvco/dada-photo-booth/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vurvco/dada-photo-booth/merges","archive_url":"https://api.github.com/repos/vurvco/dada-photo-booth/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vurvco/dada-photo-booth/downloads","issues_url":"https://api.github.com/repos/vurvco/dada-photo-booth/issues{/number}","pulls_url":"https://api.github.com/repos/vurvco/dada-photo-booth/pulls{/number}","milestones_url":"https://api.github.com/repos/vurvco/dada-photo-booth/milestones{/number}","notifications_url":"https://api.github.com/repos/vurvco/dada-photo-booth/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vurvco/dada-photo-booth/labels{/name}","releases_url":"https://api.github.com/repos/vurvco/dada-photo-booth/releases{/id}","deployments_url":"https://api.github.com/repos/vurvco/dada-photo-booth/deployments","created_at":"2017-08-30T02:58:46Z","updated_at":"2018-03-01T14:08:41Z","pushed_at":"2018-03-04T22:11:30Z","git_url":"git://github.com/vurvco/dada-photo-booth.git","ssh_url":"git@github.com:vurvco/dada-photo-booth.git","clone_url":"https://github.com/vurvco/dada-photo-booth.git","svn_url":"https://github.com/vurvco/dada-photo-booth","homepage":"","size":68858,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":7,"license":null,"forks":0,"open_issues":7,"watchers":1,"default_branch":"master"}},"base":{"label":"vurvco:master","ref":"master","sha":"e8fd14deadfa4394b08777f60312125f6763281d","user":{"login":"vurvco","id":28368172,"avatar_url":"https://avatars2.githubusercontent.com/u/28368172?v=4","gravatar_id":"","url":"https://api.github.com/users/vurvco","html_url":"https://github.com/vurvco","followers_url":"https://api.github.com/users/vurvco/followers","following_url":"https://api.github.com/users/vurvco/following{/other_user}","gists_url":"https://api.github.com/users/vurvco/gists{/gist_id}","starred_url":"https://api.github.com/users/vurvco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vurvco/subscriptions","organizations_url":"https://api.github.com/users/vurvco/orgs","repos_url":"https://api.github.com/users/vurvco/repos","events_url":"https://api.github.com/users/vurvco/events{/privacy}","received_events_url":"https://api.github.com/users/vurvco/received_events","type":"Organization","site_admin":false},"repo":{"id":101830912,"name":"dada-photo-booth","full_name":"vurvco/dada-photo-booth","owner":{"login":"vurvco","id":28368172,"avatar_url":"https://avatars2.githubusercontent.com/u/28368172?v=4","gravatar_id":"","url":"https://api.github.com/users/vurvco","html_url":"https://github.com/vurvco","followers_url":"https://api.github.com/users/vurvco/followers","following_url":"https://api.github.com/users/vurvco/following{/other_user}","gists_url":"https://api.github.com/users/vurvco/gists{/gist_id}","starred_url":"https://api.github.com/users/vurvco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vurvco/subscriptions","organizations_url":"https://api.github.com/users/vurvco/orgs","repos_url":"https://api.github.com/users/vurvco/repos","events_url":"https://api.github.com/users/vurvco/events{/privacy}","received_events_url":"https://api.github.com/users/vurvco/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/vurvco/dada-photo-booth","description":"Containerized version of the Dada Photo Booth","fork":false,"url":"https://api.github.com/repos/vurvco/dada-photo-booth","forks_url":"https://api.github.com/repos/vurvco/dada-photo-booth/forks","keys_url":"https://api.github.com/repos/vurvco/dada-photo-booth/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vurvco/dada-photo-booth/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vurvco/dada-photo-booth/teams","hooks_url":"https://api.github.com/repos/vurvco/dada-photo-booth/hooks","issue_events_url":"https://api.github.com/repos/vurvco/dada-photo-booth/issues/events{/number}","events_url":"https://api.github.com/repos/vurvco/dada-photo-booth/events","assignees_url":"https://api.github.com/repos/vurvco/dada-photo-booth/assignees{/user}","branches_url":"https://api.github.com/repos/vurvco/dada-photo-booth/branches{/branch}","tags_url":"https://api.github.com/repos/vurvco/dada-photo-booth/tags","blobs_url":"https://api.github.com/repos/vurvco/dada-photo-booth/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vurvco/dada-photo-booth/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vurvco/dada-photo-booth/git/refs{/sha}","trees_url":"https://api.github.com/repos/vurvco/dada-photo-booth/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vurvco/dada-photo-booth/statuses/{sha}","languages_url":"https://api.github.com/repos/vurvco/dada-photo-booth/languages","stargazers_url":"https://api.github.com/repos/vurvco/dada-photo-booth/stargazers","contributors_url":"https://api.github.com/repos/vurvco/dada-photo-booth/contributors","subscribers_url":"https://api.github.com/repos/vurvco/dada-photo-booth/subscribers","subscription_url":"https://api.github.com/repos/vurvco/dada-photo-booth/subscription","commits_url":"https://api.github.com/repos/vurvco/dada-photo-booth/commits{/sha}","git_commits_url":"https://api.github.com/repos/vurvco/dada-photo-booth/git/commits{/sha}","comments_url":"https://api.github.com/repos/vurvco/dada-photo-booth/comments{/number}","issue_comment_url":"https://api.github.com/repos/vurvco/dada-photo-booth/issues/comments{/number}","contents_url":"https://api.github.com/repos/vurvco/dada-photo-booth/contents/{+path}","compare_url":"https://api.github.com/repos/vurvco/dada-photo-booth/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vurvco/dada-photo-booth/merges","archive_url":"https://api.github.com/repos/vurvco/dada-photo-booth/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vurvco/dada-photo-booth/downloads","issues_url":"https://api.github.com/repos/vurvco/dada-photo-booth/issues{/number}","pulls_url":"https://api.github.com/repos/vurvco/dada-photo-booth/pulls{/number}","milestones_url":"https://api.github.com/repos/vurvco/dada-photo-booth/milestones{/number}","notifications_url":"https://api.github.com/repos/vurvco/dada-photo-booth/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vurvco/dada-photo-booth/labels{/name}","releases_url":"https://api.github.com/repos/vurvco/dada-photo-booth/releases{/id}","deployments_url":"https://api.github.com/repos/vurvco/dada-photo-booth/deployments","created_at":"2017-08-30T02:58:46Z","updated_at":"2018-03-01T14:08:41Z","pushed_at":"2018-03-04T22:11:30Z","git_url":"git://github.com/vurvco/dada-photo-booth.git","ssh_url":"git@github.com:vurvco/dada-photo-booth.git","clone_url":"https://github.com/vurvco/dada-photo-booth.git","svn_url":"https://github.com/vurvco/dada-photo-booth","homepage":"","size":68858,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":7,"license":null,"forks":0,"open_issues":7,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/vurvco/dada-photo-booth/pulls/25"},"html":{"href":"https://github.com/vurvco/dada-photo-booth/pull/25"},"issue":{"href":"https://api.github.com/repos/vurvco/dada-photo-booth/issues/25"},"comments":{"href":"https://api.github.com/repos/vurvco/dada-photo-booth/issues/25/comments"},"review_comments":{"href":"https://api.github.com/repos/vurvco/dada-photo-booth/pulls/25/comments"},"review_comment":{"href":"https://api.github.com/repos/vurvco/dada-photo-booth/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/vurvco/dada-photo-booth/pulls/25/commits"},"statuses":{"href":"https://api.github.com/repos/vurvco/dada-photo-booth/statuses/b04fa06c2404f92b2d3f51db48395f4c3006618e"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"chrisbodhi"}}