Skip to content

Instantly share code, notes, and snippets.

@tonussi
Created April 29, 2013 00:58
Show Gist options
  • Save tonussi/5479101 to your computer and use it in GitHub Desktop.
Save tonussi/5479101 to your computer and use it in GitHub Desktop.
atelie-livre
import processing.serial.*;
import cc.arduino.*;
Arduino arduino;
PShape pessoas[];
int svg, x, y, startTime, duration, position, deslocation, zoom, ledPin = 13;
void setup() {
size (700, 500);
if (frame != null)
frame.setResizable(true);
// The file "bot.svg" must be in the data folder
// of the current sketch to load successfully
pessoas = new PShape[5];
for (int pessoa = 0; pessoa < pessoas.length; pessoa++) {
pessoas[pessoa] = loadShape("p" + pessoa + ".svg");
if (pessoa != 5)
pessoas[pessoa].scale(random(1, 2));
}
background(255);
deslocation = width;
while (position == 0)
position = parseInt(random(0, 2));
if (position < 0)
deslocation = -width;
//println(Arduino.list());
//arduino = new Arduino(this, Arduino.list()[0], 9600);
//arduino.pinMode(ledPin, Arduino.OUTPUT);
}
void draw() {
background(255);
movePeople();
//arduino.digitalWrite(ledPin, Arduino.HIGH);
//delay(1000);
//arduino.digitalWrite(ledPin, Arduino.LOW);
//delay(1000);
}
void movePeople() {
shape(pessoas[svg], (x+=position)%deslocation, y, width/5, height);
}
void mouseClicked() {
svg = (svg + 1) % pessoas.length;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment