ICC
< back to sketch

int k;
int dx, dy;
float distance;
BFont myText;
int timer;

int fwX, fwY;

void setup(){
  size(400,280);
  background(255,255,255);

  myText = loadFont("BatangChe.vlw");

  rectMode(CENTER_DIAMETER);
  ellipseMode(CENTER_DIAMETER);

  //smooth();

}

void loop(){

  timer ++;
  dx = mouseX - pmouseX;
  dy = mouseY - pmouseY;
  distance = sqrt(dx*dx + dy*dy);

  if(mousePressed == true){

    if(k == 1){
      stroke(0,0,0);
      fill(0,0,0);
      line(pmouseX, pmouseY, mouseX, mouseY);
    }
    if(k == 2){
      stroke(0,0,0);
      fill(0,0,0);
      rect(mouseX,mouseY,distance,distance);

    }
    if(k == 3){
      stroke(255,255,255);
      fill(255,255,255);
      ellipse(mouseX, mouseY, distance, distance);
    }

    if(k == 4){
      fill(0,0,0);
      textFont(myText,distance );
      text("The distance is: " + distance, mouseX, mouseY);
    }

  }

  // オリジナル
  if(k == 5){



    stroke(0,0,0);

    if(timer%30==0 && timer <500){
      ellipse(mouseX, mouseY, 20, 20);
      
      //line(0, 0, timer,height);
    }

  }

}

void keyPressed(){

  if(key == 's'){
    saveFrame();
  }

  if(key == '-'){
    background(255,255,255);
  }
  if(key == '1'){
    k = 1;
  }
  if(key == '2'){
    k = 2;
  }
  if(key == '3'){
    k = 3;
  }
  if(key == '4'){
    k = 4;
  }
  if(key == '5'){
    k = 5;
  }

}

void mousePressed(){
  timer = 0;
}

< back to sketch