Created
December 22, 2014 12:24
-
-
Save potato4d/f1893f36afa91b1e2246 to your computer and use it in GitHub Desktop.
Processing Advent Calender 2014
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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