Skip to main content

Crate vleue_kinetoscope

Crate vleue_kinetoscope 

Source
Expand description

§vleue_kinetoscope

MIT/Apache 2.0 Doc Crate Bevy Tracking CI

Animated GIF and WebP player for Bevy.

animated-gif

§Usage

§System setup

Add the plugin to your app:

use bevy::prelude::*;
use vleue_kinetoscope::AnimatedImagePlugin;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_plugins(AnimatedImagePlugin);
}

§Play an animated gif

Spawn an entity with the component AnimatedImageController:

use bevy::prelude::*;
use vleue_kinetoscope::*;

fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
    commands.spawn(Camera2d);

    commands.spawn(AnimatedImageController::play(asset_server.load("cube.gif")));
}

§Play an animated WebP

Spawn an entity with the component AnimatedImageController:

use bevy::prelude::*;
use vleue_kinetoscope::*;

fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
    commands.spawn(Camera2d);

    commands.spawn(AnimatedImageController::play(asset_server.load("cube.webp")));
}

§Streaming animations

It is possible to stream an animated GIF or WebP, so that it’s not loaded completely into Memory:

use bevy::prelude::*;
use vleue_kinetoscope::*;

fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
    commands.spawn(Camera2d);

    commands.spawn(StreamingAnimatedImageController::play(asset_server.load("big-buck-bunny.webp")));
}

Streaming animated images are only played once, and can’t loop.

Wasm is not yet supported for streaming animations.

§Bevy Support

Bevyvleue_kinetoscope
mainmain
0.180.5
0.160.4
0.150.3
0.140.2
0.130.1

Structs§

AnimatedImage
An animated image asset.
AnimatedImageController
Component to help control the animation of an AnimatedImage.
AnimatedImageLoader
Loader for animated images (GIF and WebP).
AnimatedImagePlugin
A plugin for loading and displaying animated images (GIF or WebP).
AnimationPlayed
Event triggered when an animation finishes playing.
Frame
Frame of an animated image.
StreamingAnimatedImage
An animated image asset.
StreamingAnimatedImageController
Component to help control the animation of an StreamingAnimatedImage.
StreamingAnimatedImageLoader
Loader for animated images (GIF and WebP).

Enums§

StreamingFrame
Frame of an animated image.