14 releases
0.3.0 | Feb 4, 2025 |
---|---|
0.2.0 | Feb 3, 2025 |
0.1.11 | Jan 30, 2025 |
#422 in Images
1,054 downloads per month
15KB
354 lines
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
Dependencies
~0.7–1.6MB
~34K SLoC