Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
bad scrolling writing.pde
/*
* Demonstrates the use of the GifAnimation library.
* Exports a GIF-File to the sketch folder if space
* bar is pressed. Wow, feels like 90's! ;)
*/
import gifAnimation.*;
import processing.opengl.*;
GifMaker gifExport;
PImage img;
int length1 = 1000;
public void setup() {
size(1000, 420, OPENGL);
frameRate(100);
img = loadImage("text2.png");
println("gifAnimation " + Gif.version());
gifExport = new GifMaker(this, "export.gif");
gifExport.setRepeat(0); // make it an "endless" animation
gifExport.setTransparent(1,0,0); // make black the transparent color. every black pixel in the animation will be transparent
// GIF doesn't know have alpha values like processing. a pixel can only be totally transparent or totally opaque.
// set the processing background and the transparent gif color to the same value as the gifs destination background color
// (e.g. the website bg-color). Like this you can have the antialiasing from processing in the gif.
gifExport.setDelay(1000/1000);
}
void draw() {
background(1, 0, 0);
// translate(width/2, height/2);
image(img, length1,height/4);
gifExport.setDelay(1);
gifExport.addFrame();
length1 = length1-1;
}
void keyPressed() {
gifExport.finish();
println("gif saved");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.