summaryrefslogtreecommitdiff
path: root/pixel-client/src/helper.rs
blob: 9654f51947a7e225fe7fc1bc7ccfa7a11052f051 (plain)
1
2
3
4
5
6
7
8
9
10
11
use hurrycurry_protocol::glam::Vec2;

pub trait Vec2InterpolateExt {
    fn exp_to(&mut self, target: Vec2, dt: f32);
}
impl Vec2InterpolateExt for Vec2 {
    fn exp_to(&mut self, target: Vec2, dt: f32) {
        self.x = target.x + (self.x - target.x) * (-dt).exp();
        self.y = target.y + (self.y - target.y) * (-dt).exp();
    }
}