bevy_easy_gif

Crates.iobevy_easy_gif
lib.rsbevy_easy_gif
version0.2.1
created_at2025-09-20 12:13:23.18584+00
updated_at2025-10-10 18:14:59.512558+00
descriptionBevy crate for easy GIF spawning in your games
homepagehttps://github.com/chocorean/bevy-easy-gif
repositoryhttps://github.com/chocorean/bevy-easy-gif
max_upload_size
id1847691
size202,206
(Chocorean)

documentation

README

bevy-easy-gif 🐸

License License: MIT Doc Crate Bevy tracking CI testing

frog

A 0-work 0-pain way to display GIF files in your Bevy games.

[!WARNING] This project is still in the early stages of development.

Usage

This is all it takes in a system to spawn a Sprite with an animated texture from a GIF file:

// It does require a `Camera2d` and the `GifPlugin`
fn spawn_gif(mut commands: Commands, asset_server: ResMut<AssetServer>) {
    let handle: Handle<GifAsset> = asset_server.load("frog_large.gif");
    commands.spawn(
        Gif { handle }
    );
}

There are also a few examples you can check for customization.

Features matrix

Bevy version 0.16 0.17
Gif3d :heavy_check_mark: :heavy_check_mark:
GifDespawn :heavy_check_mark: :heavy_check_mark:
GifNode :heavy_check_mark: :heavy_check_mark:
Gif :heavy_check_mark: :heavy_check_mark:

Why?

GIF files are by default not supported by Bevy's asset loader (only the first frame is loaded).

The current workaround is to export GIF files as atlases, use a TextureAtlas with a Sprite, and then manually animate the sprite by changing the atlas properties.

I wanted a drop-in solution to load GIF files and display them to way they show in any other GIF viewer. Respecting the timing and the repetitions of the GIF files is supported too.

How?

This crate leverages required components introduced in Bevy 0.15. Spawning a Gif component will automatically add a Sprite alongside, and the GifPlugin will then animate the Sprite to display the frames of the GIF file. The Gif components also carry a GifPlayer, which describe the internal state of the entity: the current frame to display, and how long it should stay displayed. The GifPlayer's timer is automatically configured, after reading the GIF metadata.

Bevy support

bevy bevy-easy-gif
0.17 0.2.0
0.16 0.1.5

Tests

To test the library, run: cargo test --lib. To see an example using wasm, run bin/wasm, and open your browser.

Commit count: 9

cargo fmt