Struct scl_gui_animation::Spring2D
source · pub struct Spring2D { /* private fields */ }
Expand description
一个二维弹簧,由两个一维弹簧组成
Implementations§
source§impl Spring2D
impl Spring2D
sourcepub fn position_rounded(&mut self) -> (f64, f64)
pub fn position_rounded(&mut self) -> (f64, f64)
获得当前弹簧所在位置,但是会四舍五入成整数
sourcepub fn set_position(&mut self, value: (f64, f64))
pub fn set_position(&mut self, value: (f64, f64))
设置当前位置,注意这不是目标位置,如果当前位置不是目标位置则会发生移动
sourcepub fn set_velocity(&mut self, value: (f64, f64))
pub fn set_velocity(&mut self, value: (f64, f64))
设置当前速度,此时弹簧会立刻改变速度
sourcepub fn set_damper(&mut self, value: f64)
pub fn set_damper(&mut self, value: f64)
设置弹簧的阻尼
如果取值在 [0.0 - 1.0)
之间则会有回弹效果
如果大于等于 1.0
则会缓慢移动到目标位置而没有回弹效果
sourcepub fn set_target(&mut self, value: (f64, f64))
pub fn set_target(&mut self, value: (f64, f64))
设置弹簧的目标位置,此时弹簧会立刻开始变换
Auto Trait Implementations§
impl RefUnwindSafe for Spring2D
impl Send for Spring2D
impl Sync for Spring2D
impl Unpin for Spring2D
impl UnwindSafe for Spring2D
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