Files
FreeJ/scripts/processing/topics/animator.pde
Jaromil ae7b1ad056 progresses on processing script
processing-js 0.4 has been merged in some relevant parts
basic and topic scripts added for test
color handling fixed, more scripts show up now
2010-02-12 18:36:54 +01:00

37 lines
695 B
Plaintext

int currentFrame = 0;
PImage[] frames = new PImage[12];
int lastTime = 0;
void setup()
{
size(200, 200);
strokeWeight(4);
smooth();
background(204);
for (int i = 0; i < frames.length; i++) {
frames[i] = get(); // Create a blank frame
}
}
void draw()
{
int currentTime = millis();
if (currentTime > lastTime+100) {
nextFrame();
lastTime = currentTime;
}
if (mousePressed == true) {
line(pmouseX, pmouseY, mouseX, mouseY);
}
}
void nextFrame()
{
frames[currentFrame] = get(); // Get the display window
currentFrame++; // Increment to next frame
if (currentFrame >= frames.length) {
currentFrame = 0;
}
image(frames[currentFrame], 0, 0);
}