pub struct CurveData {
pub kind: CurveKind,
pub points: Vec<ControlPoint>,
pub closed: bool,
pub clamp_x: Option<(f32, f32)>,
pub clamp_y: Option<(f32, f32)>,
pub frequency: f32,
pub amplitude: f32,
pub phase: f32,
pub offset: f32,
pub noise_seed: u32,
pub spring_stiffness: f32,
pub spring_damping: f32,
}Fields§
§kind: CurveKind§points: Vec<ControlPoint>§closed: bool§clamp_x: Option<(f32, f32)>§clamp_y: Option<(f32, f32)>§frequency: f32§amplitude: f32§phase: f32§offset: f32§noise_seed: u32§spring_stiffness: f32§spring_damping: f32Implementations§
Source§impl CurveData
impl CurveData
pub fn new(kind: CurveKind) -> Self
pub fn linear() -> Self
pub fn ease_in_out() -> Self
pub fn bounce() -> Self
pub fn add_point(&mut self, pos: Vec2)
pub fn remove_point(&mut self, idx: usize)
pub fn segment_count(&self) -> usize
pub fn build_segment(&self, i: usize) -> CurveSegment
Sourcepub fn sample_uniform(&self, count: usize) -> Vec<Vec2>
pub fn sample_uniform(&self, count: usize) -> Vec<Vec2>
Sample the curve at count evenly-spaced x values
pub fn bounds(&self) -> (Vec2, Vec2)
Sourcepub fn to_polyline(&self, steps_per_segment: u32) -> Vec<Vec2>
pub fn to_polyline(&self, steps_per_segment: u32) -> Vec<Vec2>
Flatten to polyline for rendering
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CurveData
impl RefUnwindSafe for CurveData
impl Send for CurveData
impl Sync for CurveData
impl Unpin for CurveData
impl UnsafeUnpin for CurveData
impl UnwindSafe for CurveData
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<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>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> 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)
Convert
&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)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.