Processing_가을(벼는 익을수록 고개를 숙인다.)
그림 위에서 마우스를 움직여보면 벼가 자라 익어가는 모습을 표현하였다. 소스코드 <head> <script src="//cloud.github.com/downloads/processing-js/processing-js/processing-1.4.1.js"> </script> </head> <body> <script data-processing-target="mycanvas" type="text/processing"> float x, y; float angle1 = 0.0; float angle2 = 0.0; float segLength = 80; void setup() { size(300, 300); strokeWeight(10); stroke(181, 160, 45); x = width * 0.5; y = height * 0.5; } void draw() { background(165, 246, 255); angle1 = (mouseX/float(height) - 0.5) * -PI ; angle2 = (mouseY/float(height)- 0.5) * PI/2 ; pushMatrix(); segment(x, y+200, angle1); segment(segLength, 0, angle2); popMatrix(); pushMatrix(); segment(x+20, y+200, angle1); segment(segLength, 0, angle2); popMatrix(); pushMatrix(); segment(x+40, y+200,...




댓글
댓글 쓰기