pub struct ShakeEnvelope {
pub impulse: ShakeImpulse,
pub elapsed: f64,
pub remaining: f64,
pub strength: f32,
}Expand description
An owned snapshot of an active impulse; changing it does not change the shake.
use ferravex_math::Vec3;
use ferravex_play::camera::{CameraShake, ShakeImpulse};
let mut shake = CameraShake::new(42);
shake.push(ShakeImpulse {
translation: Vec3::X, rotation: Vec3::ZERO, duration: 1., frequency: 20.,
})?;
shake.advance(0.25)?;
let envelope = shake.envelopes().next().unwrap();
assert_eq!(envelope.elapsed, 0.25);
assert_eq!(envelope.remaining, 0.75);
assert_eq!(envelope.strength, 0.5625);Fields§
§impulse: ShakeImpulseThe accepted, unscaled impulse.
elapsed: f64Accumulated accepted delta time in seconds.
remaining: f64Seconds until expiry; always positive for an active impulse.
strength: f32Quadratic amplitude multiplier, (1 - elapsed / duration)^2, in 0..=1.
Trait Implementations§
Source§impl Clone for ShakeEnvelope
impl Clone for ShakeEnvelope
Source§fn clone(&self) -> ShakeEnvelope
fn clone(&self) -> ShakeEnvelope
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ShakeEnvelope
impl Debug for ShakeEnvelope
Source§impl PartialEq for ShakeEnvelope
impl PartialEq for ShakeEnvelope
impl Copy for ShakeEnvelope
impl StructuralPartialEq for ShakeEnvelope
Auto Trait Implementations§
impl Freeze for ShakeEnvelope
impl RefUnwindSafe for ShakeEnvelope
impl Send for ShakeEnvelope
impl Sync for ShakeEnvelope
impl Unpin for ShakeEnvelope
impl UnwindSafe for ShakeEnvelope
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
Mutably borrows from an owned value. Read more