ブラインド

ブラインド from qt_fb on Vimeo.

ブラインドのスケッチを描いた。仕組み上同期して動くから楽だ。正方形のはずがアップしたら右側にオフセットが広がってしまった
コメントアウトされたコードはビデオにエクスポートするためのもの。

import processing.video.*;

//MovieMaker mm;

int blind_num = 20;
int offset = 50;

float x,y,w,blind_h,h,t;
int count;

void setup(){
  size(500,500);
  noStroke();
  smooth();
  frameRate(48);
  rectMode(CENTER);
  
  //mm = new MovieMaker(this, width, height, "drawing.mov",
  //                     30, MovieMaker.H263, MovieMaker.HIGH);

  
  x = width/2;
  w = width - offset*2;
  blind_h = (height-offset*2)/blind_num - 1;
}

void draw(){
  count++;
  h = blind(count);
  background(0);
  for(int i=0;i<blind_num;i++){     
    y = offset + blind_h/2 + i*((height-offset*2)/blind_num);
    rect(x,y,w,h);
  }
  //mm.addFrame();
}

float blind(int c){
  float b;
  b = sin(radians(count))*blind_h;
  return b;
}

/*
void mousePressed(){
  mm.finish();
}
*/