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

How to tween both translation and scale of Transform simultaneously? #52

Closed
inodentry opened this issue Sep 19, 2022 · 2 comments
Closed
Labels
question Further information is requested

Comments

@inodentry
Copy link

This was pretty easy to do with the old bevy_easings crate, that this crate was based on, because it dealt with the entire Transform all at once.

Here, you are providing separate "lenses" for translation, rotation, and scale, and all of them set the generic parameter on Lens<T> to T: Transform, meaning that I cannot add multiple to the same entity simultaneously. There is no lens for working with the whole transform. :(

So have you made it impossible to tween between two Transforms? Only leaving the possibility to operate on one field at a time?

@djeedai
Copy link
Owner

djeedai commented Sep 19, 2022

because it dealt with the entire Transform all at once.

The animators always deal with the entire Component at once since that's what the world fetch via the system gets them.

you are providing separate "lenses" for translation, rotation, and scale

The crate is providing example lenses, yes :)

There is no lens for working with the whole transform.

Here:

#[derive(Debug, Copy, Clone, PartialEq)]
pub struct TransformLens {
    /// Start value.
    pub start: Transform,
    /// End value.
    pub end: Transform,
}

impl Lens<Transform> for TransformLens {
    fn lerp(&mut self, target: &mut Transform, ratio: f32) {
        target = ...;
    }
}

So have you made it impossible to tween between two Transforms?

Out of the box, there's no provided lens for the whole Transform indeed, because I don't think that's such a common case that this is needed. As shown above it's trivial to make your own though, and is the encouraged way for more advanced usage.

@djeedai djeedai added the question Further information is requested label Sep 19, 2022
@djeedai
Copy link
Owner

djeedai commented Sep 27, 2022

@inodentry can I close this or do you have any other question?

@djeedai djeedai closed this as completed Sep 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants