2017年4月29日土曜日

マウスの使い方練習

マウスの使い方練習。IRHH 2
PImage img;

void setup() {
  size( 600, 600 );
  background( 0, 0, 255 );
  //Thanks for Yume Yume Iro TOWN http://www.poipoi.com/yakko/cgi-bin/sb/log/eid1737.html
  img = loadImage("siruetto20080205a.png");
  stroke(255, 0.0);
}
void draw() {
  background(0, 0, 255);
  image(img, mouseX-140, mouseY-250, 280, 500);
  //image(img, mouseX-120, mouseY-80, 280, 500);

  beginShape();
  for (int i=0; i<300; i++) {
    stroke(random(0, 255), 0, 0);
    strokeWeight( random(1, 3) );

    float r0=random(0, 50);
    float r1=random(0, 50);
    float th0=random(0, 2*PI);
    float th1=random(0, 2*PI);
    line(r0*cos(th0)+mouseX-25, r0*sin(th0)+mouseY-170, r1*cos(th1)+mouseX-25, r1*sin(th1)+mouseY-170);
  }
}