drkcore

2008/10/07 22:16:29

Gainerでピンポン玉ディフューザー

とりあえずprocessingでいじる。マウスの位置に応じて色が変化するように。

コードは単純なので色もあんまり出なかった。

import processing.gainer.*;

Gainer gainer;
void setup(){
  gainer = new Gainer(this);
}

void draw(){
  background(0);
}

void mouseMoved(){

  float rx = (float)mouseX / width;
  float ry = (float)mouseY / height;
  int v0 = int(255*ry);
  int v1 = int(255*rx);

  gainer.analogOutput(0, v0);
  gainer.analogOutput(1, max(v1-v0,0));
  gainer.analogOutput(3, max(v0-v1,0));
}

参考

Comments