vleue / bevy_easings

Bevy plugin for easings and simple animations
181 stars 28 forks source link

Add public accessor for EasingComponent.direction #20

Closed dtaralla closed 2 years ago

dtaralla commented 2 years ago

A "nice to have" piece of info for ping pong easings where the calling context wants to adapt its behaviors to what direction the easing is going in.

See for instance a doppler factor calculation based on the movement introduced by this crate.

mockersf commented 2 years ago

thanks!

mockersf commented 2 years ago

@dtaralla I changed the direction to be an enum instead of an int: https://github.com/vleue/bevy_easings/commit/098460943d9f7c238f5b715c3b13c1c04247a9ac

It should work mostly the same for you, but you'll need to cast as an integer first like this: easing.direction() as i32 as f32