rusty_dragonbones

Crates.iorusty_dragonbones
lib.rsrusty_dragonbones
version0.3.0
sourcesrc
created_at2025-01-23 18:23:49.499026
updated_at2025-02-04 23:50:22.630281
descriptionDragonBones runtime for Rust
homepage
repository
max_upload_size
id1528083
size15,249
(Retropaint)

documentation

README

rusty_dragonbones

Runtime for DragonBones animations.

Installation

cargo add rusty_dragonbones

Usage

First, load a DragonBones root:

use rusty_dragonbones::runtime::{load_dragon_bones};

let root: DragonBonesRoot = load_dragon_bones("/path/to/*ske.json").expect("");

From here, animations can be called via animate(), which will return a bunch of props:

use rusty_dragonbones::runtime::{animate};

let mut props: Vec<Prop> = animate(&dbroot, 0, game_frame);

Props contain the properties of all bones in the animation at their specified frame. They can be used to animate like so:

let mut props: Vec<Prop> = animate(&dbroot, 0, game_frame);
for p in props {
    draw_image(img, p.pos.x, p.pos.y, p.scale.x, p.scale.y, p.rot);
}

This is a simplified example. In practice, you will most likely have to adjust the values here and there.

Missing Features

  • Only does linear tweening
  • Only supports one image per bone
Commit count: 0

cargo fmt