{"id":941,"date":"2018-10-10T19:47:31","date_gmt":"2018-10-10T19:47:31","guid":{"rendered":"https:\/\/www.courses.tegabrain.com\/cc18\/?page_id=941"},"modified":"2018-10-11T20:48:15","modified_gmt":"2018-10-11T20:48:15","slug":"thurs-10-11-classes","status":"publish","type":"page","link":"https:\/\/www.courses.tegabrain.com\/cc18\/thurs-10-11-classes\/","title":{"rendered":"Thurs 10\/11 Classes"},"content":{"rendered":"<ul>\n<li>Introduction to classes and objects.<\/li>\n<li>Defining a class:<\/li>\n<\/ul>\n<p><strong>Anatomy of a class (page 124):<\/strong><\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"707\" data-permalink=\"https:\/\/www.courses.tegabrain.com\/cc18\/4b-thurs-sept-27\/screen-shot-2018-09-27-at-9-24-48-am\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.courses.tegabrain.com\/cc18\/wp-content\/uploads\/2018\/09\/Screen-Shot-2018-09-27-at-9.24.48-AM.png?fit=954%2C870&amp;ssl=1\" data-orig-size=\"954,870\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Screen Shot 2018-09-27 at 9.24.48 AM\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/www.courses.tegabrain.com\/cc18\/wp-content\/uploads\/2018\/09\/Screen-Shot-2018-09-27-at-9.24.48-AM.png?fit=300%2C274&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/www.courses.tegabrain.com\/cc18\/wp-content\/uploads\/2018\/09\/Screen-Shot-2018-09-27-at-9.24.48-AM.png?fit=954%2C870&amp;ssl=1\" class=\"alignnone wp-image-707 size-full\" src=\"https:\/\/i0.wp.com\/www.courses.tegabrain.com\/cc18\/wp-content\/uploads\/2018\/09\/Screen-Shot-2018-09-27-at-9.24.48-AM.png?resize=954%2C870&#038;ssl=1\" alt=\"\" width=\"954\" height=\"870\" srcset=\"https:\/\/i0.wp.com\/www.courses.tegabrain.com\/cc18\/wp-content\/uploads\/2018\/09\/Screen-Shot-2018-09-27-at-9.24.48-AM.png?w=954&amp;ssl=1 954w, https:\/\/i0.wp.com\/www.courses.tegabrain.com\/cc18\/wp-content\/uploads\/2018\/09\/Screen-Shot-2018-09-27-at-9.24.48-AM.png?resize=300%2C274&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.courses.tegabrain.com\/cc18\/wp-content\/uploads\/2018\/09\/Screen-Shot-2018-09-27-at-9.24.48-AM.png?resize=768%2C700&amp;ssl=1 768w\" sizes=\"auto, (max-width: 954px) 100vw, 954px\" \/><\/p>\n<ul>\n<li>Declare and initialize a class (eg. use it in your code)<\/li>\n<li>Writing a class with arguments (p. 132)<\/li>\n<\/ul>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"709\" data-permalink=\"https:\/\/www.courses.tegabrain.com\/cc18\/4b-thurs-sept-27\/screen-shot-2018-09-27-at-9-27-03-am\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.courses.tegabrain.com\/cc18\/wp-content\/uploads\/2018\/09\/Screen-Shot-2018-09-27-at-9.27.03-AM.png?fit=874%2C602&amp;ssl=1\" data-orig-size=\"874,602\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Screen Shot 2018-09-27 at 9.27.03 AM\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/www.courses.tegabrain.com\/cc18\/wp-content\/uploads\/2018\/09\/Screen-Shot-2018-09-27-at-9.27.03-AM.png?fit=300%2C207&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/www.courses.tegabrain.com\/cc18\/wp-content\/uploads\/2018\/09\/Screen-Shot-2018-09-27-at-9.27.03-AM.png?fit=874%2C602&amp;ssl=1\" class=\"alignnone wp-image-709 size-full\" src=\"https:\/\/i0.wp.com\/www.courses.tegabrain.com\/cc18\/wp-content\/uploads\/2018\/09\/Screen-Shot-2018-09-27-at-9.27.03-AM.png?resize=874%2C602&#038;ssl=1\" alt=\"\" width=\"874\" height=\"602\" srcset=\"https:\/\/i0.wp.com\/www.courses.tegabrain.com\/cc18\/wp-content\/uploads\/2018\/09\/Screen-Shot-2018-09-27-at-9.27.03-AM.png?w=874&amp;ssl=1 874w, https:\/\/i0.wp.com\/www.courses.tegabrain.com\/cc18\/wp-content\/uploads\/2018\/09\/Screen-Shot-2018-09-27-at-9.27.03-AM.png?resize=300%2C207&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.courses.tegabrain.com\/cc18\/wp-content\/uploads\/2018\/09\/Screen-Shot-2018-09-27-at-9.27.03-AM.png?resize=768%2C529&amp;ssl=1 768w\" sizes=\"auto, (max-width: 874px) 100vw, 874px\" \/><\/p>\n<p>Technical exercises:<\/p>\n<ul>\n<li>Go over Chapter 8. Still confused? Try these video tutorials from Shiffman <a href=\"https:\/\/www.youtube.com\/playlist?list=PLRqwX-V7Uu6bb7z2IJaTlzwzIg_5yvL4i\">on classes.<\/a><\/li>\n<li>In Learning Processing do exercises: 8.1, 8.2.<\/li>\n<li>Also 8.5. For this exercise, download the example of the <a href=\"https:\/\/www.courses.tegabrain.com\/cc18\/wp-content\/uploads\/2018\/09\/bouncing_ball_gravity.zip\">bouncing_ball_gravity<\/a> here and create a ball class. Hint: Your class is going to have the same amount of variables as does this example. And the variables that are constantly changing for your ball (like the x and y coordinate for example) are going to be in your constructor.<\/li>\n<li>Take your ball class and make an array of 100 bouncing balls. No idea? Take a look at <a href=\"https:\/\/www.youtube.com\/watch?v=-sSRHRfK2EU\">this video tutorial<\/a>. Really stuck? Check out example 9.9 in Learning Processing.<\/li>\n<li>Note the visualizing time project due date has been extended to next Thursday Oct 18th. For next class please make a post here that breaks your planned project the steps that the program will go through as it progresses. Please do the following:<\/li>\n<\/ul>\n<p>1) Draw several sketches to show how your program changes over time.<\/p>\n<p>2) Break your program into steps and write these out in a list. Under each of these steps write out what will happen in your code to realize this step. Eg. if I wanted to make a sketch of a plant growing over time where there is a branch for each hour, and they get longer as the hour progresses, my steps might be something like:<\/p>\n<ul>\n<li><em>Draw stem of plant<\/em><\/li>\n<li><em>Make a branch class<\/em>\n<ul>\n<li><em>Make a class for a branch (class data: start and stop points, color, thickness, functions to turn on or off, grow, display)<\/em><\/li>\n<li><em>Grow branch &#8211; map branch length to minutes.<\/em><\/li>\n<li><em>Check minutes and update branch length<\/em><\/li>\n<li><em>Check whether branch is on or off and display or hide branch<\/em><\/li>\n<\/ul>\n<\/li>\n<li><em>Make an array of 24 branches, that are either &#8220;on&#8221; or &#8220;off&#8221;. At 5 there will be 5 branches that are turned on so they are displayed.<\/em><\/li>\n<li><em>Check hour and turn the corresponding number of branches in the array on or off.<\/em><\/li>\n<li><em>Draw background with sky etc.<\/em><\/li>\n<\/ul>\n<p>3) Make a start trying to code one or more of these sketches and bring to the next class.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction to classes and objects. Defining a class: Anatomy of a class (page 124): Declare and initialize a class (eg. use it in your code) Writing a class with arguments (p. 132) Technical exercises: Go over Chapter 8. Still confused? Try these video tutorials from Shiffman on classes. In Learning Processing do exercises: 8.1, 8.2.<a class=\"more-link button\" href=\"https:\/\/www.courses.tegabrain.com\/cc18\/thurs-10-11-classes\/\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"jetpack_post_was_ever_published":false,"footnotes":""},"class_list":["post-941","page","type-page","status-publish","hentry"],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/Paeb9f-fb","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/www.courses.tegabrain.com\/cc18\/wp-json\/wp\/v2\/pages\/941","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.courses.tegabrain.com\/cc18\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.courses.tegabrain.com\/cc18\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.courses.tegabrain.com\/cc18\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.courses.tegabrain.com\/cc18\/wp-json\/wp\/v2\/comments?post=941"}],"version-history":[{"count":8,"href":"https:\/\/www.courses.tegabrain.com\/cc18\/wp-json\/wp\/v2\/pages\/941\/revisions"}],"predecessor-version":[{"id":978,"href":"https:\/\/www.courses.tegabrain.com\/cc18\/wp-json\/wp\/v2\/pages\/941\/revisions\/978"}],"wp:attachment":[{"href":"https:\/\/www.courses.tegabrain.com\/cc18\/wp-json\/wp\/v2\/media?parent=941"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}