hannesmann / keyframe

A simple library for animation in Rust
MIT License
129 stars 11 forks source link

impl CanTween for MyType #3

Closed haselkern closed 4 years ago

haselkern commented 4 years ago

I'm trying to implement CanTween manually for a type that does not work with the derive macro.

impl CanTween for MyType {
    fn ease(from: Self, to: Self, time: impl Float) -> Self {
        unimplemented!()
    }
}

The keyframe::Float trait is private however, making it impossible to implement it like that.

How could I implement CanTween for MyType?

hannesmann commented 4 years ago

Float is a part of the num_traits crate. Could you try this?

impl CanTween for MyType {
    fn ease(from: Self, to: Self, time: impl keyframe::num_traits::Float) -> Self {
        unimplemented!()
    }
}
haselkern commented 4 years ago

That works perfectly, thank you!