https://github.com/codenameone/animatedgifsupport
Support for using animated GIFs as images in Codename One
https://github.com/codenameone/animatedgifsupport
Last synced: 11 months ago
JSON representation
Support for using animated GIFs as images in Codename One
- Host: GitHub
- URL: https://github.com/codenameone/animatedgifsupport
- Owner: codenameone
- Created: 2017-08-06T06:36:24.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-12-26T04:56:44.000Z (about 8 years ago)
- Last Synced: 2025-01-28T05:41:53.902Z (about 1 year ago)
- Language: Java
- Homepage: https://www.codenameone.com/
- Size: 104 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Animated Gif Support
This library adds support for using animated GIFs as images in Codename One. It's based on [this code](https://gist.github.com/devunwired/4479231) but was adapted for simple usage in Codename One.
You can use the GifImage as any other image in Codename One:
````java
Form hi = new Form("Gif", new BorderLayout());
try {
hi.add(CENTER, new ScaleImageLabel(GifImage.decode(getResourceAsStream("/giphy-downsized.gif"), 1177720)));
} catch(IOException err) {
log(err);
}
hi.show();
````
Notice that you need to pass in the length of the input stream that is decoded when opening a gif.
## Changelog
### 2017-12-25
#### Modified
- Loop checking inside animate() function yields sensible results for finite looped gifs.
- Animate function no longer skips last frame.