{"id":132,"date":"2012-02-07T21:30:12","date_gmt":"2012-02-07T21:30:12","guid":{"rendered":"http:\/\/classes.visitsteve.com\/hacking\/?p=132"},"modified":"2012-02-07T21:38:21","modified_gmt":"2012-02-07T21:38:21","slug":"sample-sketch-with-variables-conditionals-and-a-loop","status":"publish","type":"post","link":"https:\/\/classes.visitsteve.com\/hacking\/sample-sketch-with-variables-conditionals-and-a-loop\/","title":{"rendered":"Sample sketch with variables, conditionals and a loop!"},"content":{"rendered":"<p><script type=\"application\/processing\">\r\n\/\/Info: http:\/\/processingjs.org\/reference\r\n\/\/for green cirlce 1\r\nint circleI = 15;\r\nfloat circleJ=10;\r\n\/\/for green circle 2\r\nint circleK=15;\r\nfloat circleL=10;\r\n\/\/for purple stripe loop\r\nint stripe= 15;\r\n\r\nvoid setup(){\r\n  size(600,600);\r\n  background(255,255,152);\r\n  \r\n  \/\/purple stripe loop\r\nstroke (140,24,214);\r\nwhile (stripe< 500) {\r\nline (400,stripe,440,stripe);\r\nstripe=stripe+10;\r\n}\r\n}\r\n\/\/diamond\r\nvoid mousePressed(){\r\n  noStroke();\r\n  \/\/colors based on mouse position!\r\n  fill(mouseX,mouseY,mouseX+mouseY,175);\r\n  triangle(mouseX-50,mouseY,mouseX+50,mouseY,mouseX,mouseY+80);\r\n  triangle(mouseX-50,mouseY,mouseX,mouseY-50,mouseX+50,mouseY);\r\n}\r\n\r\n\/\/triangle\r\n  void draw(){\r\n  stroke(234,50,127);\r\n  fill(245,153,172,150);\r\n  triangle(mouseX, mouseY-50, mouseX-40,mouseY+20,mouseX+40,mouseY+20);\r\n\r\n\r\n \/\/pupils\r\n  fill(116,68,8,200);\r\n  ellipse(mouseX-9,mouseY-15,4,4);\r\n  ellipse(mouseX+9,mouseY-15,4,4);\r\n  \/\/mouth\r\n   arc(mouseX,mouseY-2,20,10,0,PI);\r\n  \/\/PI stands for pie,the value (3.14etc.)\r\n  \r\n  \/\/falling green circle number 1\r\n  stroke(255,255,255,150);\r\nfill(70,157,46,100);\r\nellipse (circleI,circleJ,24,24);\r\n\r\n\r\n\/\/cirlce 1 loops continuously\r\nif (circleJ>300) {circleJ=0;}\r\n\r\n\/\/rate of movement falling green circle 1\r\ncircleJ = circleJ + 1;\r\n\/\/blue eye balls\r\nnoStroke();\r\nfill(32,73,175,200);\r\nellipse(circleI+5,circleJ,5,5);\r\n\r\nnoStroke();\r\nfill(32,73,175,200);\r\nellipse(circleI-5,circleJ,5,5);\r\n\r\n\r\n    \/\/falling green circle copy2\r\n  stroke(255,255,255,150);\r\nfill(70,157,46,100);\r\nellipse (circleK+50,circleL,24,24);\r\n\r\ncircleL = circleL + 1;\r\n\/\/blue eye balls copy2\r\nnoStroke();\r\nfill(32,73,175,200);\r\nellipse(circleK+47,circleL,5,5);\r\n\r\nnoStroke();\r\nfill(32,73,175,200);\r\nellipse(circleK+55,circleL,5,5);\r\n}\r\n<\/script><\/p>\n<h2> the code!<\/h2>\n<p><!--more--> <\/p>\n<p><code><br \/>\n\/\/for green cirlce 1<br \/>\nint circleI = 15;<br \/>\nfloat circleJ=10;<br \/>\n\/\/for green circle 2<br \/>\nint circleK=15;<br \/>\nfloat circleL=10;<br \/>\n\/\/for purple stripe loop<br \/>\nint stripe= 15;<\/p>\n<p>void setup(){<br \/>\n  size(600,600);<br \/>\n  background(255,255,152);<\/p>\n<p>  \/\/purple stripe loop<br \/>\nstroke (140,24,214);<br \/>\nwhile (stripe< 500) {\nline (400,stripe,440,stripe);\nstripe=stripe+10;\n}\n}\n\/\/diamond\nvoid mousePressed(){\n  noStroke();\n  \/\/colors based on mouse position!\n  fill(mouseX,mouseY,mouseX+mouseY,175);\n  triangle(mouseX-50,mouseY,mouseX+50,mouseY,mouseX,mouseY+80);\n  triangle(mouseX-50,mouseY,mouseX,mouseY-50,mouseX+50,mouseY);\n}\n\n\/\/triangle\n  void draw(){\n  stroke(234,50,127);\n  fill(245,153,172,150);\n  triangle(mouseX, mouseY-50, mouseX-40,mouseY+20,mouseX+40,mouseY+20);\n\n\n \/\/pupils\n  fill(116,68,8,200);\n  ellipse(mouseX-9,mouseY-15,4,4);\n  ellipse(mouseX+9,mouseY-15,4,4);\n  \/\/mouth\n   arc(mouseX,mouseY-2,20,10,0,PI);\n  \/\/PI stands for pie,the value (3.14etc.)\n  \n  \/\/falling green circle number 1\n  stroke(255,255,255,150);\nfill(70,157,46,100);\nellipse (circleI,circleJ,24,24);\n\n\n\/\/cirlce 1 loops continuously\nif (circleJ>300) {circleJ=0;}<\/p>\n<p>\/\/rate of movement falling green circle 1<br \/>\ncircleJ = circleJ + 1;<br \/>\n\/\/blue eye balls<br \/>\nnoStroke();<br \/>\nfill(32,73,175,200);<br \/>\nellipse(circleI+5,circleJ,5,5);<\/p>\n<p>noStroke();<br \/>\nfill(32,73,175,200);<br \/>\nellipse(circleI-5,circleJ,5,5);<\/p>\n<p>    \/\/falling green circle copy2<br \/>\n  stroke(255,255,255,150);<br \/>\nfill(70,157,46,100);<br \/>\nellipse (circleK+50,circleL,24,24);<\/p>\n<p>circleL = circleL + 1;<br \/>\n\/\/blue eye balls copy2<br \/>\nnoStroke();<br \/>\nfill(32,73,175,200);<br \/>\nellipse(circleK+47,circleL,5,5);<\/p>\n<p>noStroke();<br \/>\nfill(32,73,175,200);<br \/>\nellipse(circleK+55,circleL,5,5);<br \/>\n}<br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>the code!<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-132","post","type-post","status-publish","format-standard","hentry","category-class-examples"],"_links":{"self":[{"href":"https:\/\/classes.visitsteve.com\/hacking\/wp-json\/wp\/v2\/posts\/132","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\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/classes.visitsteve.com\/hacking\/wp-json\/wp\/v2\/comments?post=132"}],"version-history":[{"count":0,"href":"https:\/\/classes.visitsteve.com\/hacking\/wp-json\/wp\/v2\/posts\/132\/revisions"}],"wp:attachment":[{"href":"https:\/\/classes.visitsteve.com\/hacking\/wp-json\/wp\/v2\/media?parent=132"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/classes.visitsteve.com\/hacking\/wp-json\/wp\/v2\/categories?post=132"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/classes.visitsteve.com\/hacking\/wp-json\/wp\/v2\/tags?post=132"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}