{"action":"created","comment":{"url":"https://api.github.com/repos/codezilla-nl/codezilla-website/pulls/comments/93181987","pull_request_review_id":13702123,"id":93181987,"diff_hunk":"@@ -0,0 +1,237 @@\n+import UtilInViewport from \"../utils/util.inViewport.js\";\n+import UtilRegisterScroll from \"../utils/util.registerScroll.js\";\n+\n+export default class Triangles {\n+    constructor(el) {\n+        this.options = {\n+            canvas: document.querySelector(el),\n+            color: {\n+                base: [31, 36, 39],\n+                factor: function() {\n+                    return Math.floor((Math.random()*25)-25);\n+                }\n+            },\n+            polygon: {\n+                nodes: {},\n+                width: 30,\n+                height: 30,\n+                colorCycle: 4000,\n+                drawFactor: 0.5, // likeliness of color transition being drawn\n+                transitionCycle: 100 // should never be higher than colorcycle. Maybe use requestAnimationFrame instead (although we might want a 'choppier' effect)? \n+            }\n+         };\n+\n+        this.addGlobalListeners = this.addGlobalListeners;\n+\n+        this.init();\n+        this.addListeners();\n+    }\n+\n+    init() {\n+        this.generate();\n+        this.cycleColors();\n+        this.isInView();\n+    }\n+\n+    // Set events, listeners\n+    addListeners() {\n+        //On mousedown, set mousemove listener for glow\n+        this.options.canvas.addEventListener(\"mousedown\", () => {\n+            this.options.canvas.onmousemove = (e) => {\n+                this.glow(e);\n+            }\n+        });\n+\n+        // On mouseup, remove mousemove listener\n+        this.options.canvas.addEventListener(\"mouseup\", () => {\n+            this.options.canvas.onmousemove = null;\n+        });\n+    }\n+\n+    // These listeners should be called once.\n+    addGlobalListeners() {\n+        let debounce;\n+        window.addEventListener(\"resize\", () => {\n+            clearTimeout(debounce); //Poor man's debounce\n+            debounce = setTimeout(this.init.bind(this), 100);\n+        });\n+\n+        new UtilRegisterScroll(this.isInView.bind(this), 'requestAnimationFrame');\n+    }\n+\n+    // Determine if the canvas is in view\n+    isInView() {\n+        let state = UtilInViewport(this.options.canvas);\n+        this.toggleAnimate(state.inView);\n+    }\n+\n+    glow(e) {\n+        //Determine bounds of canvas and offset mouse position to polygon node\n+        let bounds = this.options.canvas.getBoundingClientRect(),\n+            posX = Math.floor(e.clientX - bounds.left),\n+            posY = Math.floor(e.clientY - bounds.top),\n+            h = Math.floor(posX / this.options.polygon.width),\n+            v = Math.floor(posY / (this.options.polygon.height / 2));\n+\n+        if (posX > 0 && posY > 0 && posX < bounds.width && posY < bounds.height) { // If within canvas\n+            let node = this.options.polygon.nodes[`${h}-${v}`], // Select node based on mouse position\n+                offset = [\n+                    node.color[0],\n+                    node.color[1] + 15, // Make it green\n+                    node.color[2]\n+                ];\n+\n+            node.color = offset;\n+            node.endColor = offset;\n+        }\n+    }\n+\n+    // Toggle animate (set intervals or clear them)\n+    toggleAnimate(doAnimate) {\n+        if (doAnimate) {\n+            // Regenerate colors every color cycle\n+            if (!this.options.colorCycle) {\n+                this.options.colorCycle = setInterval(() => {\n+                    this.cycleColors();\n+                }, this.options.polygon.colorCycle);\n+            }\n+\n+            // Transition to endColor during the color cycle\n+            if (!this.options.transitionCycle) {\n+                this.options.transitionCycle = setInterval(() => {\n+                    this.transitionColors();\n+                }, this.options.polygon.transitionCycle);\n+            }\n+        } else {\n+            clearInterval(this.options.colorCycle);\n+            this.options.colorCycle = undefined;\n+            clearInterval(this.options.transitionCycle);\n+            this.options.transitionCycle = undefined;\n+        }\n+    }\n+\n+    // Generate new colors for all nodes\n+    cycleColors() {\n+        let polygons = this.options.polygon.nodes;\n+        this.options.polygon.intervalCycle = 0;\n+\n+        for(let p in polygons) { \n+            let polygon = polygons[p];\n+            if (polygon.endColor) {\n+                polygon.startColor = polygon.endColor;\n+            }\n+            polygons[p].endColor = this.generateColor();\n+        }\n+        this.options.polygon.nodes = polygons;\n+    }\n+\n+    // Transition colors from start to end color\n+    transitionColors() {\n+        let polygons = this.options.polygon.nodes,\n+            cycle = ((100 / (this.options.polygon.colorCycle / this.options.polygon.transitionCycle)) / 100) * ++this.options.polygon.intervalCycle; //100% / (cycle time) = 2.5% => 2.5/100 = 0.025\n+\n+        for(let p in polygons) { \n+            let polygon = polygons[p];\n+            if (Math.random() > this.options.polygon.drawFactor) { // This will give more randomness to the transitioning colors\n+                polygon.color = this.diffColorAtPercentage(polygon.startColor, polygon.endColor, cycle);\n+            }\n+        }\n+        this.drawPolygons(polygons);\n+    }\n+\n+    // Generates the nodes (polygons) based on context size\n+    generate() {\n+        const c = this.options.canvas,","path":"src/classes/Triangles.js","position":144,"original_position":144,"commit_id":"7ac8edb4c3df862ca5a444322544f96fb83d8ef9","original_commit_id":"7ac8edb4c3df862ca5a444322544f96fb83d8ef9","user":{"login":"jellekralt","id":214558,"avatar_url":"https://avatars.githubusercontent.com/u/214558?v=3","gravatar_id":"","url":"https://api.github.com/users/jellekralt","html_url":"https://github.com/jellekralt","followers_url":"https://api.github.com/users/jellekralt/followers","following_url":"https://api.github.com/users/jellekralt/following{/other_user}","gists_url":"https://api.github.com/users/jellekralt/gists{/gist_id}","starred_url":"https://api.github.com/users/jellekralt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jellekralt/subscriptions","organizations_url":"https://api.github.com/users/jellekralt/orgs","repos_url":"https://api.github.com/users/jellekralt/repos","events_url":"https://api.github.com/users/jellekralt/events{/privacy}","received_events_url":"https://api.github.com/users/jellekralt/received_events","type":"User","site_admin":false},"body":"Using  \r\n```javascript\r\nconst foo = 'bar';\r\nconst baz = 'qux';\r\n```\r\nwould solve the nasty spacing issue we were talking about 😛.\r\nAlso, it doesnt depend on the number of spaces :)","created_at":"2016-12-20T07:16:25Z","updated_at":"2016-12-20T07:18:59Z","html_url":"https://github.com/codezilla-nl/codezilla-website/pull/32#discussion_r93181987","pull_request_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/pulls/32","_links":{"self":{"href":"https://api.github.com/repos/codezilla-nl/codezilla-website/pulls/comments/93181987"},"html":{"href":"https://github.com/codezilla-nl/codezilla-website/pull/32#discussion_r93181987"},"pull_request":{"href":"https://api.github.com/repos/codezilla-nl/codezilla-website/pulls/32"}}},"pull_request":{"url":"https://api.github.com/repos/codezilla-nl/codezilla-website/pulls/32","id":98565715,"html_url":"https://github.com/codezilla-nl/codezilla-website/pull/32","diff_url":"https://github.com/codezilla-nl/codezilla-website/pull/32.diff","patch_url":"https://github.com/codezilla-nl/codezilla-website/pull/32.patch","issue_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/issues/32","number":32,"state":"open","locked":false,"title":"Feature/modern background","user":{"login":"hvgeertruy","id":2580632,"avatar_url":"https://avatars.githubusercontent.com/u/2580632?v=3","gravatar_id":"","url":"https://api.github.com/users/hvgeertruy","html_url":"https://github.com/hvgeertruy","followers_url":"https://api.github.com/users/hvgeertruy/followers","following_url":"https://api.github.com/users/hvgeertruy/following{/other_user}","gists_url":"https://api.github.com/users/hvgeertruy/gists{/gist_id}","starred_url":"https://api.github.com/users/hvgeertruy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hvgeertruy/subscriptions","organizations_url":"https://api.github.com/users/hvgeertruy/orgs","repos_url":"https://api.github.com/users/hvgeertruy/repos","events_url":"https://api.github.com/users/hvgeertruy/events{/privacy}","received_events_url":"https://api.github.com/users/hvgeertruy/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-12-19T13:33:36Z","updated_at":"2016-12-20T07:18:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f805d58506d58238d5d538ffeeba1aac7f69b28d","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/pulls/32/commits","review_comments_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/pulls/32/comments","review_comment_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/pulls/comments{/number}","comments_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/issues/32/comments","statuses_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/statuses/7ac8edb4c3df862ca5a444322544f96fb83d8ef9","head":{"label":"codezilla-nl:feature/modern-background","ref":"feature/modern-background","sha":"7ac8edb4c3df862ca5a444322544f96fb83d8ef9","user":{"login":"codezilla-nl","id":15939684,"avatar_url":"https://avatars.githubusercontent.com/u/15939684?v=3","gravatar_id":"","url":"https://api.github.com/users/codezilla-nl","html_url":"https://github.com/codezilla-nl","followers_url":"https://api.github.com/users/codezilla-nl/followers","following_url":"https://api.github.com/users/codezilla-nl/following{/other_user}","gists_url":"https://api.github.com/users/codezilla-nl/gists{/gist_id}","starred_url":"https://api.github.com/users/codezilla-nl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codezilla-nl/subscriptions","organizations_url":"https://api.github.com/users/codezilla-nl/orgs","repos_url":"https://api.github.com/users/codezilla-nl/repos","events_url":"https://api.github.com/users/codezilla-nl/events{/privacy}","received_events_url":"https://api.github.com/users/codezilla-nl/received_events","type":"Organization","site_admin":false},"repo":{"id":70731141,"name":"codezilla-website","full_name":"codezilla-nl/codezilla-website","owner":{"login":"codezilla-nl","id":15939684,"avatar_url":"https://avatars.githubusercontent.com/u/15939684?v=3","gravatar_id":"","url":"https://api.github.com/users/codezilla-nl","html_url":"https://github.com/codezilla-nl","followers_url":"https://api.github.com/users/codezilla-nl/followers","following_url":"https://api.github.com/users/codezilla-nl/following{/other_user}","gists_url":"https://api.github.com/users/codezilla-nl/gists{/gist_id}","starred_url":"https://api.github.com/users/codezilla-nl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codezilla-nl/subscriptions","organizations_url":"https://api.github.com/users/codezilla-nl/orgs","repos_url":"https://api.github.com/users/codezilla-nl/repos","events_url":"https://api.github.com/users/codezilla-nl/events{/privacy}","received_events_url":"https://api.github.com/users/codezilla-nl/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/codezilla-nl/codezilla-website","description":"CODEZILLA Website","fork":false,"url":"https://api.github.com/repos/codezilla-nl/codezilla-website","forks_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/forks","keys_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/keys{/key_id}","collaborators_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/teams","hooks_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/hooks","issue_events_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/issues/events{/number}","events_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/events","assignees_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/assignees{/user}","branches_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/branches{/branch}","tags_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/tags","blobs_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/git/refs{/sha}","trees_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/git/trees{/sha}","statuses_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/statuses/{sha}","languages_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/languages","stargazers_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/stargazers","contributors_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/contributors","subscribers_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/subscribers","subscription_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/subscription","commits_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/commits{/sha}","git_commits_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/git/commits{/sha}","comments_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/comments{/number}","issue_comment_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/issues/comments{/number}","contents_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/contents/{+path}","compare_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/compare/{base}...{head}","merges_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/merges","archive_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/downloads","issues_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/issues{/number}","pulls_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/pulls{/number}","milestones_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/milestones{/number}","notifications_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/labels{/name}","releases_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/releases{/id}","deployments_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/deployments","created_at":"2016-10-12T18:50:49Z","updated_at":"2016-11-25T21:35:17Z","pushed_at":"2016-12-20T07:11:22Z","git_url":"git://github.com/codezilla-nl/codezilla-website.git","ssh_url":"git@github.com:codezilla-nl/codezilla-website.git","clone_url":"https://github.com/codezilla-nl/codezilla-website.git","svn_url":"https://github.com/codezilla-nl/codezilla-website","homepage":"","size":5331,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"develop"}},"base":{"label":"codezilla-nl:feature/hackathon","ref":"feature/hackathon","sha":"cf34fbdd90829a34d9265ad75486d43cc7183421","user":{"login":"codezilla-nl","id":15939684,"avatar_url":"https://avatars.githubusercontent.com/u/15939684?v=3","gravatar_id":"","url":"https://api.github.com/users/codezilla-nl","html_url":"https://github.com/codezilla-nl","followers_url":"https://api.github.com/users/codezilla-nl/followers","following_url":"https://api.github.com/users/codezilla-nl/following{/other_user}","gists_url":"https://api.github.com/users/codezilla-nl/gists{/gist_id}","starred_url":"https://api.github.com/users/codezilla-nl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codezilla-nl/subscriptions","organizations_url":"https://api.github.com/users/codezilla-nl/orgs","repos_url":"https://api.github.com/users/codezilla-nl/repos","events_url":"https://api.github.com/users/codezilla-nl/events{/privacy}","received_events_url":"https://api.github.com/users/codezilla-nl/received_events","type":"Organization","site_admin":false},"repo":{"id":70731141,"name":"codezilla-website","full_name":"codezilla-nl/codezilla-website","owner":{"login":"codezilla-nl","id":15939684,"avatar_url":"https://avatars.githubusercontent.com/u/15939684?v=3","gravatar_id":"","url":"https://api.github.com/users/codezilla-nl","html_url":"https://github.com/codezilla-nl","followers_url":"https://api.github.com/users/codezilla-nl/followers","following_url":"https://api.github.com/users/codezilla-nl/following{/other_user}","gists_url":"https://api.github.com/users/codezilla-nl/gists{/gist_id}","starred_url":"https://api.github.com/users/codezilla-nl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codezilla-nl/subscriptions","organizations_url":"https://api.github.com/users/codezilla-nl/orgs","repos_url":"https://api.github.com/users/codezilla-nl/repos","events_url":"https://api.github.com/users/codezilla-nl/events{/privacy}","received_events_url":"https://api.github.com/users/codezilla-nl/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/codezilla-nl/codezilla-website","description":"CODEZILLA Website","fork":false,"url":"https://api.github.com/repos/codezilla-nl/codezilla-website","forks_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/forks","keys_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/keys{/key_id}","collaborators_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/teams","hooks_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/hooks","issue_events_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/issues/events{/number}","events_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/events","assignees_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/assignees{/user}","branches_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/branches{/branch}","tags_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/tags","blobs_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/git/refs{/sha}","trees_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/git/trees{/sha}","statuses_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/statuses/{sha}","languages_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/languages","stargazers_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/stargazers","contributors_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/contributors","subscribers_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/subscribers","subscription_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/subscription","commits_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/commits{/sha}","git_commits_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/git/commits{/sha}","comments_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/comments{/number}","issue_comment_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/issues/comments{/number}","contents_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/contents/{+path}","compare_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/compare/{base}...{head}","merges_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/merges","archive_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/downloads","issues_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/issues{/number}","pulls_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/pulls{/number}","milestones_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/milestones{/number}","notifications_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/labels{/name}","releases_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/releases{/id}","deployments_url":"https://api.github.com/repos/codezilla-nl/codezilla-website/deployments","created_at":"2016-10-12T18:50:49Z","updated_at":"2016-11-25T21:35:17Z","pushed_at":"2016-12-20T07:11:22Z","git_url":"git://github.com/codezilla-nl/codezilla-website.git","ssh_url":"git@github.com:codezilla-nl/codezilla-website.git","clone_url":"https://github.com/codezilla-nl/codezilla-website.git","svn_url":"https://github.com/codezilla-nl/codezilla-website","homepage":"","size":5331,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/codezilla-nl/codezilla-website/pulls/32"},"html":{"href":"https://github.com/codezilla-nl/codezilla-website/pull/32"},"issue":{"href":"https://api.github.com/repos/codezilla-nl/codezilla-website/issues/32"},"comments":{"href":"https://api.github.com/repos/codezilla-nl/codezilla-website/issues/32/comments"},"review_comments":{"href":"https://api.github.com/repos/codezilla-nl/codezilla-website/pulls/32/comments"},"review_comment":{"href":"https://api.github.com/repos/codezilla-nl/codezilla-website/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/codezilla-nl/codezilla-website/pulls/32/commits"},"statuses":{"href":"https://api.github.com/repos/codezilla-nl/codezilla-website/statuses/7ac8edb4c3df862ca5a444322544f96fb83d8ef9"}}}}
{"actor":{"display_login":"jellekralt"}}