Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bevy_animation: Abstract away interpolation #11501

Closed

Conversation

valaphee
Copy link
Contributor

Objective

  • For each combination of keyframe type (position, rotation, ..) and interpolation type the interpolation is separately implemented.

Solution

  • Implement a trait for all keyframe types which defines the methods required for lerp and cubic spline

Should be a non-breaking change as it is only internal

Theoretically lerp could also be abstracted to addition and subtraction and would remove the trait body, but for quats, slerp is used instead of lerp

Weights are also a little bit interesting as I needed a stride for the keyframes array, which is 1 for all other types, but the compiler should optimize it away.

@alice-i-cecile alice-i-cecile added C-Code-Quality A section of code that is hard to understand or change A-Animation Make things move and change over time labels Jan 24, 2024
@alice-i-cecile
Copy link
Member

I like the direction of this abstraction, but we should consider the interaction with #4482 (which could use some help over the finish line).

@mweatherley
Copy link
Contributor

Closing this as superseded by the curve-based animation restructure (#15434).

@mweatherley mweatherley closed this Oct 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Animation Make things move and change over time C-Code-Quality A section of code that is hard to understand or change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants