Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #[derive(Debug, Copy, Clone, PartialEq)]
- struct CameraFovLens {
- pub start: f32,
- pub end: f32,
- }
- impl Lens<Projection> for CameraFovLens {
- fn lerp(&mut self, target: &mut Projection, ratio: f32) {
- if let Projection::Perspective(ref mut proj) = &mut *target {
- let value = self.start + (self.end - self.start) * ratio;
- proj.fov = value;
- }
- }
- }
- // todo this stuff doesn't actually work
- pub fn camera_fov_animator(start: f32, end: f32) -> Animator<Projection> {
- let tween = Tween::new(
- EaseFunction::QuadraticOut,
- Duration::from_millis(100),
- CameraFovLens { start, end },
- );
- Animator::new(tween)
- }
Advertisement
Add Comment
Please, Sign In to add comment