Gif animation / Using a Processing version 3.3.5 / Please let me know how to run it.

edited December 2017 in Library Questions

I want to put a gif image into the program.

By the way,

https://github.com/01010101/GifAnimation#void-setdelayint-ms

It is said that Processing 3.0 or later is also available on the site.

However, it does not work if you actually insert the code.

I want to know how to operate in JAVA mode.

Answers

  • Please be more specific than saying "it does not work". What does it do? Do you see an error? Can you please post a MCVE?

  • question

    An error message pops up.

    Is it possible to work with Processing 3.0 or later? Is it possible?

  • Please never post screenshots of code or error messages. Copy and paste the code and error messages as text.

    Have you added the library to your sketch?

  • Gif animation / Using a Processing version 3.3.5 https://github.com/01010101/GifAnimation#void-setdelayint-ms

    Source code(Basic example source code)

    import gifAnimation.*;
    
    PImage[] animation;
    Gif loopingGif;
    Gif nonLoopingGif;
    boolean pause = false;
    
    public void setup() {
      size(400, 200);
      frameRate(100);
    
      println("gifAnimation " + Gif.version());
      // create the GifAnimation object for playback
      loopingGif = new Gif(this, "lavalamp.gif");
      loopingGif.loop();
      nonLoopingGif = new Gif(this, "lavalamp.gif");
      nonLoopingGif.play();
      nonLoopingGif.ignoreRepeat();
      // create the PImage array for the interactive display
      animation = Gif.getPImages(this, "lavalamp.gif");
    }
    
    void draw() {
      background(255 / (float)height * mouseY);
      image(loopingGif, 10, height / 2 - loopingGif.height / 2);
      image(nonLoopingGif, width/2 - nonLoopingGif.width/2, height / 2 - nonLoopingGif.height / 2);
      image(animation[(int) (animation.length / (float) (width) * mouseX)], width - 10 - animation[0].width, height / 2 - animation[0].height / 2);
    }
    
    void mousePressed() {
      nonLoopingGif.play();
    }
    
    void keyPressed() {
      if (key == ' ') {
        if (pause) {
          nonLoopingGif.play();
          loopingGif.play();
          pause = false;
        } 
        else {
          nonLoopingGif.pause();
          loopingGif.pause();
          pause = true;
        }
      }
    }
    

    DOWNLOAD -> GifAnimation.zip (compatible with Processing 3.x)

    Please tell me why.

  • Answer ✓

    This library is not compatible with Processing as one can see from the library manager when running the Processing IDE. I believe this library is from https://github.com/extrapixel/gif-animation. I installed this library manually and I can verify that the library doesn't work with Processing 3.3.6. However, I downloaded another library from another branch: https://github.com/01010101/GifAnimation, I installed it manually and it worked out of the box. It seems they tried to merge the branches but I don't think it went all the way through so I assume from conversation here

    Notice there is another library called ImageLoader. If you install it, you can see in the examples that it has an gif display example. Please keep in mind Processing doesn't like you to have these two libraries installed at the same time. In a nutshell, just install one of them and you will be fine.

    Kf

  • @kfrajer

    Thanks. ~ ^^

Sign In or Register to comment.