43个版本 (23个稳定版)

4.1.3 2023年7月1日
4.1.2 2023年1月9日
4.1.0 2022年10月11日
4.0.0-alpha.92022年7月31日
0.3.0 2021年7月19日

#27 in #game

Download history • Rust 包仓库 52/week @ 2024-04-22 • Rust 包仓库 31/week @ 2024-04-29 • Rust 包仓库 23/week @ 2024-05-06 • Rust 包仓库 34/week @ 2024-05-13 • Rust 包仓库 30/week @ 2024-05-20 • Rust 包仓库 26/week @ 2024-05-27 • Rust 包仓库 64/week @ 2024-06-03 • Rust 包仓库 15/week @ 2024-06-10 • Rust 包仓库 30/week @ 2024-06-17 • Rust 包仓库 30/week @ 2024-06-24 • Rust 包仓库 83/week @ 2024-07-01 • Rust 包仓库 13/week @ 2024-07-08 • Rust 包仓库 15/week @ 2024-07-15 • Rust 包仓库 18/week @ 2024-07-22 • Rust 包仓库 586/week @ 2024-07-29 • Rust 包仓库 28/week @ 2024-08-05 • Rust 包仓库

649 个月下载量
用于 bevy_ase

Unlicense OR MIT

43KB
1K SLoC

Benimator

License Crates.io rustc Docs

适用于Rust游戏开发的精灵动画库。

最初是为bevy设计的,现在是引擎无关的。

目标

本项目旨在提供构建块,以方便使用任何游戏引擎进行2D精灵动画。

非目标

Benimator不渲染任何内容。它仅跟踪精灵索引。

预期将Benimator与bevy等游戏引擎一起使用。

外观

在其核心,benimator是一个Animation数据结构和用于跟踪帧索引随时间变化的State

// Create an animation
let animation = Animation::from_indices(0..=3, FrameRate::from_fps(10.0));

// Create a new animation state
let mut state = State::new();

// In the game loop, for each update, tell the state how much time has elapsed
let delta_time = Duration::from_millis(250);
state.update(&animation, delta_time);

// Then get the current frame index.
// (so that we can tell our engine to render the sprite at that index)
assert_eq!(state.frame_index(), 2);

请查看使用bevy游戏引擎的完整示例示例

安装

benimator发布在crates.io

您可以使用以下命令将依赖项添加到您的Cargo文件中

cargo add benimator

Cargo功能

功能 描述
serde 实现SerializeDeserialize

未在此处提及的功能标志不是公共API的一部分,并可能发生破坏性更改!

MSRV

当前支持的最小Rust版本是1.60

当需要时,它可以更新到较新的稳定版本,这不会被视为破坏性更改(它可以在次要或补丁版本中发生)。

许可

许可为以下之一

任选其一。

依赖关系

~185KB