Imagine my annoyance when I discover that this blogsite doesn't allow animated gifs in a profile! At least for me, it only displays the first frame, so I've removed it.
One useful thing I discovered - when downloading a new library (in this case gifAnimation), you need to exit & restart the IDE after you've copied the library folder to the right place.
For those who care, here's my code:
import gifAnimation.*; // needs gifAnimation library from http://www.extrapixel.ch/processing/gifAnimation/
PImage a;
int blobwidth;
int blobheight;
int y;
int x;
GifMaker gifExport;
void setup()
{
a = loadImage("pict5124a.jpg"); // name of image to scan
size(a.width,a.height);
noStroke();
background(0); // black background to prevent flashing between loops
smooth();
blobwidth = width;
blobheight = height / 15;
y=0;
x=0;
gifExport = new GifMaker(this, "export.gif");
gifExport.setRepeat(0); // make it an "endless" animation
}
void draw()
{
fill(0, 0, 0, 64); // fade existing lines by overwriting with black. Last parameter = 0 for no fade; 255 for maximum fade)
rect(0,0,width, height); // this is the actual overwrite
PImage blob = a.get(x, y, blobwidth, blobheight); // get blob
image(blob, x, y); // and write to screen
x = x + blobwidth; //scan horizontally
if (x >= width)
{
x = 0;
y = y + blobheight; // scan vertically
if (y >= height)
{
y = 0;
gifExport.finish(); // finalise the gif after one run through
}
}
gifExport.addFrame();
}
And here's me:
(edited to correct obiwan error)
1 comment:
Thanks, James, got the library and the program works perfectly!
Post a Comment