{"action":"created","comment":{"url":"https://api.github.com/repos/nannou-org/nannou/pulls/comments/193569542","pull_request_review_id":126555266,"id":193569542,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5MzU2OTU0Mg==","diff_hunk":"@@ -0,0 +1,94 @@\n+// The Nature of Code\n+// Daniel Shiffman\n+// http://natureofcode.com\n+//\n+// example 4-01: Single Particle\n+extern crate nannou;\n+\n+use nannou::prelude::*;\n+\n+fn main() {\n+    nannou::app(model, event, view).run();\n+}\n+\n+struct Model {\n+    p: Particle,\n+}\n+\n+// A simple particle type\n+struct Particle {\n+    position: Vector2<f32>,\n+    velocity: Vector2<f32>,\n+    acceleration: Vector2<f32>,\n+    life_span: f32,\n+}\n+\n+impl Particle {\n+    fn new(l: Vector2<f32>) -> Self {\n+        let acceleration = Vector2::new(0.0, 0.05);\n+        let velocity = Vector2::new(random::<f32>() * 2.0 - 1.0, random::<f32>() - 1.0);\n+        let position = l;\n+        let life_span = 255.0;\n+        Particle {\n+            acceleration,\n+            velocity,\n+            position,\n+            life_span,\n+        }\n+    }\n+\n+    // Method to update position\n+    fn update(&mut self) {\n+        self.velocity += self.acceleration;\n+        self.position -= self.velocity;\n+        self.life_span -= 2.0;\n+    }\n+\n+    // Method to display\n+    fn display(&self, draw: &app::Draw) {\n+        draw.ellipse()\n+            .x_y(self.position.x, self.position.y)\n+            .w_h(12.0, 12.0)\n+            .rgba(0.5, 0.5, 0.5, self.life_span / 255.0);\n+    }\n+\n+    // Is the poarticel still useful?\n+    fn is_dead(&self) -> bool {\n+        if self.life_span < 0.0 {\n+            true\n+        } else {\n+            false\n+        }\n+    }\n+}\n+\n+fn model(app: &App) -> Model {\n+    let _window = app.new_window().with_dimensions(640, 360).build().unwrap();\n+    let p = Particle::new(Vector2::new(0.0, app.window_rect().top() - 20.0));\n+    Model { p }\n+}\n+\n+fn event(app: &App, mut m: Model, event: Event) -> Model {\n+    // update gets called just before view every frame\n+    if let Event::Update(_update) = event {\n+        m.p.update();\n+        if m.p.is_dead() {\n+            m.p = Particle::new(Vector2::new(0.0, app.window_rect().top() - 20.0));","path":"examples/nature_of_code/chp_04_systems/4_01_single_particle.rs","position":76,"original_position":76,"commit_id":"94c1faf775491954e93957ec82b22b00acc3a5f9","original_commit_id":"94c1faf775491954e93957ec82b22b00acc3a5f9","user":{"login":"mitchmindtree","id":4587373,"node_id":"MDQ6VXNlcjQ1ODczNzM=","avatar_url":"https://avatars1.githubusercontent.com/u/4587373?v=4","gravatar_id":"","url":"https://api.github.com/users/mitchmindtree","html_url":"https://github.com/mitchmindtree","followers_url":"https://api.github.com/users/mitchmindtree/followers","following_url":"https://api.github.com/users/mitchmindtree/following{/other_user}","gists_url":"https://api.github.com/users/mitchmindtree/gists{/gist_id}","starred_url":"https://api.github.com/users/mitchmindtree/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mitchmindtree/subscriptions","organizations_url":"https://api.github.com/users/mitchmindtree/orgs","repos_url":"https://api.github.com/users/mitchmindtree/repos","events_url":"https://api.github.com/users/mitchmindtree/events{/privacy}","received_events_url":"https://api.github.com/users/mitchmindtree/received_events","type":"User","site_admin":false},"body":"`vec2`","created_at":"2018-06-06T21:47:02Z","updated_at":"2018-06-06T22:03:41Z","html_url":"https://github.com/nannou-org/nannou/pull/134#discussion_r193569542","pull_request_url":"https://api.github.com/repos/nannou-org/nannou/pulls/134","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/nannou-org/nannou/pulls/comments/193569542"},"html":{"href":"https://github.com/nannou-org/nannou/pull/134#discussion_r193569542"},"pull_request":{"href":"https://api.github.com/repos/nannou-org/nannou/pulls/134"}}},"pull_request":{"url":"https://api.github.com/repos/nannou-org/nannou/pulls/134","id":193139945,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkzMTM5OTQ1","html_url":"https://github.com/nannou-org/nannou/pull/134","diff_url":"https://github.com/nannou-org/nannou/pull/134.diff","patch_url":"https://github.com/nannou-org/nannou/pull/134.patch","issue_url":"https://api.github.com/repos/nannou-org/nannou/issues/134","number":134,"state":"open","locked":false,"title":"Adding in examples for the first 3 chapters and chapter 7 in the nature of code, started on generative gestaltung examples","user":{"login":"JoshuaBatty","id":1289413,"node_id":"MDQ6VXNlcjEyODk0MTM=","avatar_url":"https://avatars3.githubusercontent.com/u/1289413?v=4","gravatar_id":"","url":"https://api.github.com/users/JoshuaBatty","html_url":"https://github.com/JoshuaBatty","followers_url":"https://api.github.com/users/JoshuaBatty/followers","following_url":"https://api.github.com/users/JoshuaBatty/following{/other_user}","gists_url":"https://api.github.com/users/JoshuaBatty/gists{/gist_id}","starred_url":"https://api.github.com/users/JoshuaBatty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JoshuaBatty/subscriptions","organizations_url":"https://api.github.com/users/JoshuaBatty/orgs","repos_url":"https://api.github.com/users/JoshuaBatty/repos","events_url":"https://api.github.com/users/JoshuaBatty/events{/privacy}","received_events_url":"https://api.github.com/users/JoshuaBatty/received_events","type":"User","site_admin":false},"body":"Pushing the first third of the examples outlined in #86 \r\nUpdated the Cargo.toml so we can nest examples inside sub directories ","created_at":"2018-06-06T21:03:25Z","updated_at":"2018-06-06T22:03:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9c5ac60879fea3dff1cad9cdb922c801fcf29b7a","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/nannou-org/nannou/pulls/134/commits","review_comments_url":"https://api.github.com/repos/nannou-org/nannou/pulls/134/comments","review_comment_url":"https://api.github.com/repos/nannou-org/nannou/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nannou-org/nannou/issues/134/comments","statuses_url":"https://api.github.com/repos/nannou-org/nannou/statuses/94c1faf775491954e93957ec82b22b00acc3a5f9","head":{"label":"JoshuaBatty:examples","ref":"examples","sha":"94c1faf775491954e93957ec82b22b00acc3a5f9","user":{"login":"JoshuaBatty","id":1289413,"node_id":"MDQ6VXNlcjEyODk0MTM=","avatar_url":"https://avatars3.githubusercontent.com/u/1289413?v=4","gravatar_id":"","url":"https://api.github.com/users/JoshuaBatty","html_url":"https://github.com/JoshuaBatty","followers_url":"https://api.github.com/users/JoshuaBatty/followers","following_url":"https://api.github.com/users/JoshuaBatty/following{/other_user}","gists_url":"https://api.github.com/users/JoshuaBatty/gists{/gist_id}","starred_url":"https://api.github.com/users/JoshuaBatty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JoshuaBatty/subscriptions","organizations_url":"https://api.github.com/users/JoshuaBatty/orgs","repos_url":"https://api.github.com/users/JoshuaBatty/repos","events_url":"https://api.github.com/users/JoshuaBatty/events{/privacy}","received_events_url":"https://api.github.com/users/JoshuaBatty/received_events","type":"User","site_admin":false},"repo":{"id":114201585,"node_id":"MDEwOlJlcG9zaXRvcnkxMTQyMDE1ODU=","name":"nannou","full_name":"JoshuaBatty/nannou","owner":{"login":"JoshuaBatty","id":1289413,"node_id":"MDQ6VXNlcjEyODk0MTM=","avatar_url":"https://avatars3.githubusercontent.com/u/1289413?v=4","gravatar_id":"","url":"https://api.github.com/users/JoshuaBatty","html_url":"https://github.com/JoshuaBatty","followers_url":"https://api.github.com/users/JoshuaBatty/followers","following_url":"https://api.github.com/users/JoshuaBatty/following{/other_user}","gists_url":"https://api.github.com/users/JoshuaBatty/gists{/gist_id}","starred_url":"https://api.github.com/users/JoshuaBatty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JoshuaBatty/subscriptions","organizations_url":"https://api.github.com/users/JoshuaBatty/orgs","repos_url":"https://api.github.com/users/JoshuaBatty/repos","events_url":"https://api.github.com/users/JoshuaBatty/events{/privacy}","received_events_url":"https://api.github.com/users/JoshuaBatty/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/JoshuaBatty/nannou","description":"A Creative Coding Framework for Rust","fork":true,"url":"https://api.github.com/repos/JoshuaBatty/nannou","forks_url":"https://api.github.com/repos/JoshuaBatty/nannou/forks","keys_url":"https://api.github.com/repos/JoshuaBatty/nannou/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JoshuaBatty/nannou/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JoshuaBatty/nannou/teams","hooks_url":"https://api.github.com/repos/JoshuaBatty/nannou/hooks","issue_events_url":"https://api.github.com/repos/JoshuaBatty/nannou/issues/events{/number}","events_url":"https://api.github.com/repos/JoshuaBatty/nannou/events","assignees_url":"https://api.github.com/repos/JoshuaBatty/nannou/assignees{/user}","branches_url":"https://api.github.com/repos/JoshuaBatty/nannou/branches{/branch}","tags_url":"https://api.github.com/repos/JoshuaBatty/nannou/tags","blobs_url":"https://api.github.com/repos/JoshuaBatty/nannou/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JoshuaBatty/nannou/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JoshuaBatty/nannou/git/refs{/sha}","trees_url":"https://api.github.com/repos/JoshuaBatty/nannou/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JoshuaBatty/nannou/statuses/{sha}","languages_url":"https://api.github.com/repos/JoshuaBatty/nannou/languages","stargazers_url":"https://api.github.com/repos/JoshuaBatty/nannou/stargazers","contributors_url":"https://api.github.com/repos/JoshuaBatty/nannou/contributors","subscribers_url":"https://api.github.com/repos/JoshuaBatty/nannou/subscribers","subscription_url":"https://api.github.com/repos/JoshuaBatty/nannou/subscription","commits_url":"https://api.github.com/repos/JoshuaBatty/nannou/commits{/sha}","git_commits_url":"https://api.github.com/repos/JoshuaBatty/nannou/git/commits{/sha}","comments_url":"https://api.github.com/repos/JoshuaBatty/nannou/comments{/number}","issue_comment_url":"https://api.github.com/repos/JoshuaBatty/nannou/issues/comments{/number}","contents_url":"https://api.github.com/repos/JoshuaBatty/nannou/contents/{+path}","compare_url":"https://api.github.com/repos/JoshuaBatty/nannou/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JoshuaBatty/nannou/merges","archive_url":"https://api.github.com/repos/JoshuaBatty/nannou/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JoshuaBatty/nannou/downloads","issues_url":"https://api.github.com/repos/JoshuaBatty/nannou/issues{/number}","pulls_url":"https://api.github.com/repos/JoshuaBatty/nannou/pulls{/number}","milestones_url":"https://api.github.com/repos/JoshuaBatty/nannou/milestones{/number}","notifications_url":"https://api.github.com/repos/JoshuaBatty/nannou/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JoshuaBatty/nannou/labels{/name}","releases_url":"https://api.github.com/repos/JoshuaBatty/nannou/releases{/id}","deployments_url":"https://api.github.com/repos/JoshuaBatty/nannou/deployments","created_at":"2017-12-14T04:14:42Z","updated_at":"2018-04-15T12:24:30Z","pushed_at":"2018-06-06T20:58:36Z","git_url":"git://github.com/JoshuaBatty/nannou.git","ssh_url":"git@github.com:JoshuaBatty/nannou.git","clone_url":"https://github.com/JoshuaBatty/nannou.git","svn_url":"https://github.com/JoshuaBatty/nannou","homepage":null,"size":947,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"nannou-org:master","ref":"master","sha":"6e11f87e4d6642fe8622894194b08e6350b61a9a","user":{"login":"nannou-org","id":38399209,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM4Mzk5MjA5","avatar_url":"https://avatars2.githubusercontent.com/u/38399209?v=4","gravatar_id":"","url":"https://api.github.com/users/nannou-org","html_url":"https://github.com/nannou-org","followers_url":"https://api.github.com/users/nannou-org/followers","following_url":"https://api.github.com/users/nannou-org/following{/other_user}","gists_url":"https://api.github.com/users/nannou-org/gists{/gist_id}","starred_url":"https://api.github.com/users/nannou-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nannou-org/subscriptions","organizations_url":"https://api.github.com/users/nannou-org/orgs","repos_url":"https://api.github.com/users/nannou-org/repos","events_url":"https://api.github.com/users/nannou-org/events{/privacy}","received_events_url":"https://api.github.com/users/nannou-org/received_events","type":"Organization","site_admin":false},"repo":{"id":102113773,"node_id":"MDEwOlJlcG9zaXRvcnkxMDIxMTM3NzM=","name":"nannou","full_name":"nannou-org/nannou","owner":{"login":"nannou-org","id":38399209,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM4Mzk5MjA5","avatar_url":"https://avatars2.githubusercontent.com/u/38399209?v=4","gravatar_id":"","url":"https://api.github.com/users/nannou-org","html_url":"https://github.com/nannou-org","followers_url":"https://api.github.com/users/nannou-org/followers","following_url":"https://api.github.com/users/nannou-org/following{/other_user}","gists_url":"https://api.github.com/users/nannou-org/gists{/gist_id}","starred_url":"https://api.github.com/users/nannou-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nannou-org/subscriptions","organizations_url":"https://api.github.com/users/nannou-org/orgs","repos_url":"https://api.github.com/users/nannou-org/repos","events_url":"https://api.github.com/users/nannou-org/events{/privacy}","received_events_url":"https://api.github.com/users/nannou-org/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nannou-org/nannou","description":"A Creative Coding Framework for Rust.","fork":false,"url":"https://api.github.com/repos/nannou-org/nannou","forks_url":"https://api.github.com/repos/nannou-org/nannou/forks","keys_url":"https://api.github.com/repos/nannou-org/nannou/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nannou-org/nannou/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nannou-org/nannou/teams","hooks_url":"https://api.github.com/repos/nannou-org/nannou/hooks","issue_events_url":"https://api.github.com/repos/nannou-org/nannou/issues/events{/number}","events_url":"https://api.github.com/repos/nannou-org/nannou/events","assignees_url":"https://api.github.com/repos/nannou-org/nannou/assignees{/user}","branches_url":"https://api.github.com/repos/nannou-org/nannou/branches{/branch}","tags_url":"https://api.github.com/repos/nannou-org/nannou/tags","blobs_url":"https://api.github.com/repos/nannou-org/nannou/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nannou-org/nannou/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nannou-org/nannou/git/refs{/sha}","trees_url":"https://api.github.com/repos/nannou-org/nannou/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nannou-org/nannou/statuses/{sha}","languages_url":"https://api.github.com/repos/nannou-org/nannou/languages","stargazers_url":"https://api.github.com/repos/nannou-org/nannou/stargazers","contributors_url":"https://api.github.com/repos/nannou-org/nannou/contributors","subscribers_url":"https://api.github.com/repos/nannou-org/nannou/subscribers","subscription_url":"https://api.github.com/repos/nannou-org/nannou/subscription","commits_url":"https://api.github.com/repos/nannou-org/nannou/commits{/sha}","git_commits_url":"https://api.github.com/repos/nannou-org/nannou/git/commits{/sha}","comments_url":"https://api.github.com/repos/nannou-org/nannou/comments{/number}","issue_comment_url":"https://api.github.com/repos/nannou-org/nannou/issues/comments{/number}","contents_url":"https://api.github.com/repos/nannou-org/nannou/contents/{+path}","compare_url":"https://api.github.com/repos/nannou-org/nannou/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nannou-org/nannou/merges","archive_url":"https://api.github.com/repos/nannou-org/nannou/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nannou-org/nannou/downloads","issues_url":"https://api.github.com/repos/nannou-org/nannou/issues{/number}","pulls_url":"https://api.github.com/repos/nannou-org/nannou/pulls{/number}","milestones_url":"https://api.github.com/repos/nannou-org/nannou/milestones{/number}","notifications_url":"https://api.github.com/repos/nannou-org/nannou/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nannou-org/nannou/labels{/name}","releases_url":"https://api.github.com/repos/nannou-org/nannou/releases{/id}","deployments_url":"https://api.github.com/repos/nannou-org/nannou/deployments","created_at":"2017-09-01T13:07:25Z","updated_at":"2018-06-06T20:06:57Z","pushed_at":"2018-06-06T21:03:26Z","git_url":"git://github.com/nannou-org/nannou.git","ssh_url":"git@github.com:nannou-org/nannou.git","clone_url":"https://github.com/nannou-org/nannou.git","svn_url":"https://github.com/nannou-org/nannou","homepage":"http://nannou.cc/","size":846,"stargazers_count":114,"watchers_count":114,"language":"Rust","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":10,"mirror_url":null,"archived":false,"open_issues_count":40,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":10,"open_issues":40,"watchers":114,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nannou-org/nannou/pulls/134"},"html":{"href":"https://github.com/nannou-org/nannou/pull/134"},"issue":{"href":"https://api.github.com/repos/nannou-org/nannou/issues/134"},"comments":{"href":"https://api.github.com/repos/nannou-org/nannou/issues/134/comments"},"review_comments":{"href":"https://api.github.com/repos/nannou-org/nannou/pulls/134/comments"},"review_comment":{"href":"https://api.github.com/repos/nannou-org/nannou/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nannou-org/nannou/pulls/134/commits"},"statuses":{"href":"https://api.github.com/repos/nannou-org/nannou/statuses/94c1faf775491954e93957ec82b22b00acc3a5f9"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"mitchmindtree"}}