wiki:ateliers:processing:2:ketai
- ketaiDessin.pde
import ketai.sensors.*;
int rouge, vert, bleu;
KetaiSensor sensor;
void setup() {
orientation(LANDSCAPE);
size(displayWidth, displayHeight);
sensor = new KetaiSensor(this);
sensor.start();
background(255);
}
void draw() {
fill(rouge, vert, bleu);
noStroke();
ellipse(mouseX, mouseY, width/20, width/20);
}
void onAccelerometerEvent(float x, float y, float z) {
rouge = (int)(((x<0)?-x:x) * 20);
vert = (int)(((y<0)?-y:y) * 20);
bleu = (int)(((z<0)?-z:z) * 20);
}
void keyPressed() {
if (key == CODED) {
if (keyCode == MENU) {
background(255);
}
}
}
wiki/ateliers/processing/2/ketai.txt · Dernière modification: 2016/09/11 13:16 (modification externe)