기본 콘텐츠로 건너뛰기

second animation image(2) - 가을은 다양함(숫자)에서 다가온다.








소스코드

int rectWidth;
   
void setup() {
  size(400 , 300);
  noStroke();
  background(139,144,104);
  rectWidth = width/5;
}

void draw() { 
  // keep draw() here to continue looping while waiting for keys
}

void keyPressed() {
  int keyIndex = -1;
  char m = 0;
  if (key >= '1' && key <= '9') {
    keyIndex = key - '1';
  } else if (key >= '1' && key <= '9'|| key == 'm') {
    keyIndex = key - '1';
  }
  if (keyIndex == -1) {
    // If it's not a letter key, clear the screen
    background(217,174,104);
  } else { 
    // It's a letter key, fill a rectangle
    fill(millis() % random(255),random(255),random(255));
    float x = map(keyIndex, 0, 10, 2, width - rectWidth);
    rect(0, x, 400, rectWidth);
  }
  if (key == 'm') saveFrame("line-##.png");
}

댓글

이 블로그의 인기 게시물

제품인터랙션 light cube

아두이노 코드 조명부 #include <Encoder.h> Encoder myEnc(3, 4); long oldPosition  = -999; // 13번핀에 빨간색 LED를 연결합니다. int redPin = 9; // 12번핀에 노란색 LED를 연결합니다. int bluePin = 11; // 11번핀에 초록색 LED를 연결합니다. 로터리엔코더모듈센서부 int greenPin = 10; // 로터리 엔코더의 aPin을 4번핀에 연결합니다. int aPin = 4; // 로터리 엔코더의 bPIn을 3번핀에 연결합니다. int bPin = 3; // 로터리 엔코더의 푸시버튼을 2번핀에 연결합니다. int buttonPin = 5; // 현재 상태를 저장합니다. int state = 0; // 초록색이나 빨간색일 때 불이 들어오는 시간을 설정합니다. int longPeriod = 100; // 신호가 바뀔때의 시간을 설정합니다. int shortPeriod = 10; int targetCount = shortPeriod; int count = 0; void setup() {   pinMode(aPin, INPUT);   pinMode(bPin, INPUT);   Serial.begin(9600);   pinMode(buttonPin, INPUT_PULLUP);   Serial.println(INPUT_PULLUP);   pinMode(redPin, OUTPUT);   pinMode(bluePin, OUTPUT);   pinMode(greenPin, OUTPUT); } void loop() {   count++;   // 푸시버튼이 LOW일때   if (digitalRead(buttonPin)...

3D Print_(11)_Light x Virgil Alavlo_Final Pannel

"off-white" X "on-black"

3D Print_(2)_전통문양과 디지털디자인의 미래에 대한 생각 PPT