pub struct CameraAnimator { /* private fields */ }Expand description
Smooth camera controller with exponential damping and animated transitions.
Feed raw input deltas via apply_orbit,
apply_pan, apply_zoom. Then call
update once per frame to apply decayed velocities to the
camera.
For animated transitions (view presets, zoom-to-fit), use
fly_to. Any raw input during a flight cancels it.
Implementations§
Source§impl CameraAnimator
impl CameraAnimator
Sourcepub fn new(damping: CameraDamping) -> Self
pub fn new(damping: CameraDamping) -> Self
Create an animator with custom damping.
Sourcepub fn with_default_damping() -> Self
pub fn with_default_damping() -> Self
Create an animator with sensible default damping values.
Sourcepub fn apply_orbit(&mut self, yaw_delta: f32, pitch_delta: f32)
pub fn apply_orbit(&mut self, yaw_delta: f32, pitch_delta: f32)
Feed a raw orbit delta (yaw, pitch) in radians.
Sourcepub fn apply_pan(&mut self, right_delta: f32, up_delta: f32)
pub fn apply_pan(&mut self, right_delta: f32, up_delta: f32)
Feed a raw pan delta (right, up) in world units.
Sourcepub fn apply_zoom(&mut self, delta: f32)
pub fn apply_zoom(&mut self, delta: f32)
Feed a raw zoom delta (distance change).
Sourcepub fn fly_to(
&mut self,
camera: &Camera,
target_center: Vec3,
target_distance: f32,
target_orientation: Quat,
duration: f32,
)
pub fn fly_to( &mut self, camera: &Camera, target_center: Vec3, target_distance: f32, target_orientation: Quat, duration: f32, )
Start an animated fly-to transition with default easing.
Sourcepub fn fly_to_with_easing(
&mut self,
camera: &Camera,
target_center: Vec3,
target_distance: f32,
target_orientation: Quat,
duration: f32,
easing: Easing,
)
pub fn fly_to_with_easing( &mut self, camera: &Camera, target_center: Vec3, target_distance: f32, target_orientation: Quat, duration: f32, easing: Easing, )
Start an animated fly-to transition with custom easing and optional projection change.
Sourcepub fn fly_to_full(
&mut self,
camera: &Camera,
target_center: Vec3,
target_distance: f32,
target_orientation: Quat,
target_projection: Option<Projection>,
duration: f32,
easing: Easing,
)
pub fn fly_to_full( &mut self, camera: &Camera, target_center: Vec3, target_distance: f32, target_orientation: Quat, target_projection: Option<Projection>, duration: f32, easing: Easing, )
Start a fly-to transition with all options.
Sourcepub fn cancel_flight(&mut self)
pub fn cancel_flight(&mut self)
Cancel any active fly-to animation.
Sourcepub fn is_animating(&self) -> bool
pub fn is_animating(&self) -> bool
Returns true if the animator has residual velocity or an active flight.
Auto Trait Implementations§
impl Freeze for CameraAnimator
impl RefUnwindSafe for CameraAnimator
impl Send for CameraAnimator
impl Sync for CameraAnimator
impl Unpin for CameraAnimator
impl UnsafeUnpin for CameraAnimator
impl UnwindSafe for CameraAnimator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.