| Crates.io | rusty_dragonbones |
| lib.rs | rusty_dragonbones |
| version | 0.3.0 |
| created_at | 2025-01-23 18:23:49.499026+00 |
| updated_at | 2025-02-04 23:50:22.630281+00 |
| description | DragonBones runtime for Rust |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1528083 |
| size | 15,249 |
Runtime for DragonBones animations.
cargo add rusty_dragonbones
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.