Exporting Animated Gif's (glitch)
in
Contributed Library Questions
•
3 years ago
Hi guys - sorry for the total noob question :)
i've just started messing about with Processing - and i'm teaching myself about loops right now.
i wrote a very pedestrian bit of code that draws an area of points
and then assigns these points a spectrum of color and then made them change slightly with every iteration of the loop
- import gifAnimation.*;
- GifMaker gifExport;
- float a = (0);
- float b = (255);
- float changea = 2.5;
- float changeb = -2.5;
- void setup(){
- size(500,500);
- background(0);
- rectMode(CENTER);
- println("gifAnimation " + Gif.version());
- gifExport = new GifMaker(this, "export-###.gif");
- gifExport.setRepeat(0);
- }
- void draw(){
- if (keyPressed == true) {
- gifExport.finish();
- }else{
- //gifExport.setDelay(1);
- gifExport.addFrame();
- }
- for (int i = 50; i <=450; i+=3) {
- for (int j = 50; j<=450; j+=3){
- stroke(255,0,i-a);
- point(i,j);
- a += changea;
- b += changeb;
- if((a<0)||(a>255)){
- changea *= -1;
- }
- if((b<0)||(b>255)){
- changeb *= -1;
- }
- }
- }
- }
i also imported a gif exporting library - and it all works great
but the gifs come with a blank frame at the end (??) (see below)
i was wondering if there's a way to tell it to not include that blank frame :)
thank you :)
1