Skip to content

Instantly share code, notes, and snippets.

@potato4d
Created December 22, 2014 12:24
Show Gist options
  • Save potato4d/f1893f36afa91b1e2246 to your computer and use it in GitHub Desktop.
Save potato4d/f1893f36afa91b1e2246 to your computer and use it in GitHub Desktop.
Processing Advent Calender 2014
import ketai.sensors.*;
KetaiSensor sensor;
float x, y, z, r;
float vx, vy, vz;
void setup(){
sensor = new KetaiSensor(this);
sensor.start();
orientation(LANDSCAPE);
x = width/2;
y = height/2;
}
void draw(){
background(255, 32);
vx = cos(radians(r))*6;
vy = sin(radians(r))*6;
x += vx;
y += vy;
fill(0, 255, 255, 192);
noStroke();
ellipse(x, y, 96, 96);
}
void onAccelerometerEvent(float x, float y, float z){
r += y*2.0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment