Loading...
Logo
Processing Forum
guiseiz's Profile
1 Posts
3 Responses
0 Followers

Activity Trend

Last 30 days

Loading Chart...

Show:
Private Message
    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

    1. import gifAnimation.*;

    2. GifMaker gifExport;
    3. float a = (0);
    4. float b = (255);

    5. float changea = 2.5;
    6. float changeb = -2.5;

    7. void setup(){
    8. size(500,500);
    9. background(0);
    10. rectMode(CENTER);
    11.  println("gifAnimation " + Gif.version());
    12.   gifExport = new GifMaker(this, "export-###.gif");
    13.   gifExport.setRepeat(0);
    14. }

    15. void draw(){
    16.     if (keyPressed == true) {
    17.   gifExport.finish();
    18. }else{
    19.   //gifExport.setDelay(1);
    20.   gifExport.addFrame();
    21. }

    22. for (int i = 50; i <=450; i+=3) {
    23.   for (int j = 50; j<=450; j+=3){
    24.   stroke(255,0,i-a);    
    25.   point(i,j);

    26. a += changea;
    27. b += changeb;

    28. if((a<0)||(a>255)){
    29.  changea *= -1;
    30. }
    31.   if((b<0)||(b>255)){
    32.   changeb *= -1;
    33. }
    34. }
    35. }
    36. }

    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 :)