Crate bevy_lookup_curve

Crate bevy_lookup_curve 

Source
Expand description

§bevy_lookup_curve 📈

github Latest version Documentation MIT Apache

Editable lookup curve for Bevy that can be used for many things, for example:

  • Animation
  • Gameplay progressiom (control different aspects over time or other variables)
  • Physics (for example: tweakable feel on a character controller)
  • Probability control (for item drops etc)
  • Shaders
  • … just about anything where you need a formula (x -> y) that you can fine tune, with a GUI instead of diving into math

If you have used AnimationCurve in Unity, this would be an attempt at something similar for Bevy.

§Features

  • LookupCurve type with modifiable knots and tangents. Three types of interpolation: Constant, Linear, and Cubic
  • LookupCurve implements bevy_math::Curve<f32> to fit into the ecosystem, giving access to resampling and other conveniences.
  • Asset loader and save functionality
  • egui-based editor
  • Integration with bevy-inspector-egui for quick and easy tweaking

https://github.com/villor/bevy_lookup_curve/assets/7102243/180aed95-ca9a-4e3b-97c4-2516055ea648

§Usage

See examples for now.

The animation example demonstrates how to both use and edit a curve in a Bevy app.

§Feature flags

FeatureDefaultDescription
serializeYesEnable serde serialization/deserialization for the LookupCurve
ronYesEnable loading/saving the curve as a ron file
bevy_reflectYesImplement Reflect on most types in the crate
bevy_assetYesImplement AssetLoader for LookupCurve
editor_eguiYesEnables the egui-based editor
editor_bevyYesECS component for convenient spawning of editor windows inside Bevy
inspector-eguiNoIntegration with bevy-inspector-egui

§Bevy support

bevybevy_lookup_curve
0.180.11
0.170.10
0.160.9
0.150.6-0.8
0.140.3-0.5
0.130.1-0.2

§Using without Bevy

This crate can be used without Bevy as well (except for bevy_math which is a core dependency).

Just set default-features = false. And enable serialize, ron, and/or editor_egui if needed.

See the egui_only example. It can also be used as a standalone curve editor.

§Contributing

Contributions are welcome. Feel free to make a PR!

§License

Dual-licensed under either:

Modules§

asset
Contains the asset loader plugin for LookupCurve assets.
editor
Contains editor implementations for LookupCurves.
prelude
Re-exports of the most commonly used items for convenience

Structs§

Knot
A knot in a LookupCurve.
LookupCache
Cache to speed up coherent lookups, see LookupCurve::lookup_cached
LookupCurve
Two-dimensional spline that only allows a single y-value per x-value
LookupCurvePlugin
Registers the asset loader and editor components
LookupOptions
Options for advanced lookup in a LookupCurve. See LookupCurve::lookup_advanced
Tangent
Tangents are used to control cubic interpolation for Knots in a LookupCurve

Enums§

KnotInterpolation
Interpolation used between a Knot the next knot
LookupCurveLoadError
Errors that can occur when loading a LookupCurve from a RON file
LookupCurveSaveError
Errors that can occur when saving a LookupCurve to a RON file
TangentMode
How a tangent behaves when a knot or its tangents are moved
TangentSide
Specifies which tangent of a Knot to target for some operations.