기본 콘텐츠로 건너뛰기

Animation_Autumn

void setup()
{
   background(58, 15, 2);
  size(600, 600);
}

float degree= 0.0;
int xPos, yPos;

void draw()
{
  pushMatrix();
  translate(xPos, yPos);
  rotate(degree);
  ellipse(xPos/10, yPos/10, 60, 10);
  popMatrix();
  degree +=0.5;
}
void mousePressed()
{
   color c = color (25, 255, 0, 200);
  fill(c);
 ellipse(xPos, yPos, 50 , 50);
   c = color (random(255), 53, 7, 180);
  fill(c);
  ellipse(xPos, yPos, 60, 60 );
 
  ellipse(xPos, yPos, 20, 20);
 
xPos = mouseX;
yPos = mouseY;
}
void keypressed()
{
  if(key == 's') saveFrame("filename-####.png");
}

댓글

이 블로그의 인기 게시물

Good grip_Task Analysis_Handcart_1

Good grip_Color Test

Interactive Toy_Snap4Arduino_Cording

Analog reading 0에 Distance sensor Analog reading 2에 Sound Sensor Digtal reading 4 에 Sub Motor1 Digtal reading 7 에 Sub Motor2 Analog 0번에서 500이상의 수치 값이 되면 4번에 있는 sub motor 가 0.03초 뒤에 작동하며, 180도로 바뀐다. 수치값이 500이상이 아닐경우는 초기값으로 돌아온다. Analog 2번에서 130이상의 수치 값이 되면 7번에 있는 sub motor가 0.01초 뒤에 작동하며, 각도는 1도 부터 180도 사이의 랜덤으로 바뀐다.