Guest User

tweening doesn't work

a guest
Oct 14th, 2023
11
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 0.69 KB | None | 0 0
  1. #[derive(Debug, Copy, Clone, PartialEq)]
  2. struct CameraFovLens {
  3.     pub start: f32,
  4.     pub end: f32,
  5. }
  6.  
  7. impl Lens<Projection> for CameraFovLens {
  8.     fn lerp(&mut self, target: &mut Projection, ratio: f32) {
  9.         if let Projection::Perspective(ref mut proj) = &mut *target {
  10.             let value = self.start + (self.end - self.start) * ratio;
  11.             proj.fov = value;
  12.         }
  13.     }
  14. }
  15.  
  16. // todo this stuff doesn't actually work
  17. pub fn camera_fov_animator(start: f32, end: f32) -> Animator<Projection> {
  18.     let tween = Tween::new(
  19.         EaseFunction::QuadraticOut,
  20.         Duration::from_millis(100),
  21.         CameraFovLens { start, end },
  22.     );
  23.  
  24.     Animator::new(tween)
  25. }
Advertisement
Add Comment
Please, Sign In to add comment