//PreWrite: One of my biggest interests is moving head-
//intelligent lighting. I want to animate the panning motion
//of a PowerSpot 575. I filmed my light and will animate it
//first in flash.
//alot of masking took place in order to
//edit only the moving light into sweet animation
float x;
float y; //this stands for a place holder for when i
//put together y control to this moving head.
float easing = 0.1;
int numFrames = 40;
int frame = 0;
PImage[] images = new PImage[numFrames];
void setup() {
size(400, 400);
frameRate(30);
for(int i=0; i<images.length; i++) {
String imageName = "mover" + nf(i, 3) + ".jpg";
images[i] = loadImage(imageName);
}
}
void draw() {
float targetX = mouseX;
float targetY = mouseY;
float dx = targetX-x;
float dy = targetY-y;
if (abs(dx) > 1.0) {
x += dx * easing;
}
if (abs(dy) > 1.0) {
y += dy * easing;
}
//I want the mover to be more floid and actually look
//as if it were in operation rather than manically
//follow the mousex.
int g = int (x);
frame = g/10;
image(images[frame], 0, 0);
}
Exercise 11: Load a sequence of images into an array and use the mouse position to control the sequence and time of their display.