{"id":31,"date":"2011-02-12T16:06:25","date_gmt":"2011-02-12T16:06:25","guid":{"rendered":"http:\/\/classes.visitsteve.com\/hacking\/?p=31"},"modified":"2011-02-12T16:06:25","modified_gmt":"2011-02-12T16:06:25","slug":"expanding-circles","status":"publish","type":"post","link":"https:\/\/classes.visitsteve.com\/hacking\/expanding-circles\/","title":{"rendered":"expanding circles"},"content":{"rendered":"<p><script type=\"application\/processing\">\r\n\/\/Info: http:\/\/processingjs.org\/reference\r\n\/\/ declaring variables\r\nint circleX = 100; \r\nint circleY = 100;\r\nint circleW = 50;\r\nint circleH = 50;\r\nint circleBg = 100;\r\nint circleStroke = 255;\r\nint circleFill = 0;\r\n\r\n\/\/ setup\r\nvoid setup() { \r\n  size(200,200);\r\n}\r\n\r\n\/\/ draw\r\nvoid draw() { \r\n  background(circleBg); \r\n  stroke(circleStroke); \r\n  fill(circleFill); \r\n  \r\n  \/\/ four circles\r\n  ellipse(circleX-50,circleY-50,circleH,circleW);\r\n  ellipse(circleX+50,circleY-50,circleH,circleW);\r\n  ellipse(circleX+50,circleY+50,circleH,circleW);\r\n  ellipse(circleX-50,circleY+50,circleH,circleW);\r\n  \r\n  \/\/ action!\r\n  circleW = circleW+2;\r\n  circleH = circleH+2;\r\n  circleBg = circleH;\r\n  circleFill = (-circleH*1)+(255);\r\n  \r\n  \/\/ constraints\r\n  circleFill = constrain(circleFill,0,255);\r\n  circleH = constrain(circleH,0,height*2);\r\n  circleW = constrain(circleW,0,width*2);\r\n}\r\n\r\nvoid mousePressed() {\r\n  \/\/ when mouse is pressed, reset it all and start again\r\n  circleW = 1;\r\n  circleH = 1;\r\n  loop();\r\n}\r\n<\/script><\/p>\n<h2>code<\/h2>\n<p><code><br \/>\n\/\/ declaring variables<br \/>\nint circleX = 100;<br \/>\nint circleY = 100;<br \/>\nint circleW = 50;<br \/>\nint circleH = 50;<br \/>\nint circleBg = 100;<br \/>\nint circleStroke = 255;<br \/>\nint circleFill = 0;<\/p>\n<p>\/\/ setup<br \/>\nvoid setup() {<br \/>\n  size(200,200);<br \/>\n}<\/p>\n<p>\/\/ draw<br \/>\nvoid draw() {<br \/>\n  background(circleBg);<br \/>\n  stroke(circleStroke);<br \/>\n  fill(circleFill); <\/p>\n<p>  \/\/ four circles<br \/>\n  ellipse(circleX-50,circleY-50,circleH,circleW);<br \/>\n  ellipse(circleX+50,circleY-50,circleH,circleW);<br \/>\n  ellipse(circleX+50,circleY+50,circleH,circleW);<br \/>\n  ellipse(circleX-50,circleY+50,circleH,circleW);<\/p>\n<p>  \/\/ action!<br \/>\n  circleW = circleW+2;<br \/>\n  circleH = circleH+2;<br \/>\n  circleBg = circleH;<br \/>\n  circleFill = (-circleH*1)+(255);<\/p>\n<p>  \/\/ constraints<br \/>\n  circleFill = constrain(circleFill,0,255);<br \/>\n  circleH = constrain(circleH,0,height*2);<br \/>\n  circleW = constrain(circleW,0,width*2);<br \/>\n}<\/p>\n<p>void mousePressed() {<br \/>\n  \/\/ when mouse is pressed, reset it all and start again<br \/>\n  circleW = 1;<br \/>\n  circleH = 1;<br \/>\n  loop();<br \/>\n}<br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>code \/\/ declaring variables int circleX = 100; int circleY = 100; int circleW = 50; int circleH = 50; int circleBg = 100; int circleStroke = 255; int circleFill = 0; \/\/ setup void setup() { size(200,200); } \/\/ &hellip; <a href=\"https:\/\/classes.visitsteve.com\/hacking\/expanding-circles\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-31","post","type-post","status-publish","format-standard","hentry","category-classnews"],"_links":{"self":[{"href":"https:\/\/classes.visitsteve.com\/hacking\/wp-json\/wp\/v2\/posts\/31","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/classes.visitsteve.com\/hacking\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/classes.visitsteve.com\/hacking\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/classes.visitsteve.com\/hacking\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/classes.visitsteve.com\/hacking\/wp-json\/wp\/v2\/comments?post=31"}],"version-history":[{"count":0,"href":"https:\/\/classes.visitsteve.com\/hacking\/wp-json\/wp\/v2\/posts\/31\/revisions"}],"wp:attachment":[{"href":"https:\/\/classes.visitsteve.com\/hacking\/wp-json\/wp\/v2\/media?parent=31"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/classes.visitsteve.com\/hacking\/wp-json\/wp\/v2\/categories?post=31"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/classes.visitsteve.com\/hacking\/wp-json\/wp\/v2\/tags?post=31"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}