KeySpline
struct · ferroui-base · v0.5.0
struct KeySpline
Determines how an animation is used based on a cubic bezier curve. X1 and X2 must be between 0.0 and 1.0, inclusive.
Members
TYPEto_refconstructnewwith_pointsparsecontrol_point_x1set_control_point_x1control_point_y1set_control_point_y1control_point_x2set_control_point_x2control_point_y2set_control_point_y2get_spline_progressis_valid
TYPE
const TYPE: &'static $crate::TypeInfo
The runtime type of this class.
to_ref
fn to_ref(self: &Self) -> $crate::Ref<KeySpline>
Returns a strong reference to this object.
construct
fn construct(x1: f64, y1: f64, x2: f64, y2: f64) -> Self
Creates the class data; see FerroObject::construct.
new
fn new() -> Ref<Self>
Creates a key spline with the default control points (0, 0) and
(1, 1).
with_points
fn with_points(x1: f64, y1: f64, x2: f64, y2: f64) -> Ref<Self>
Creates a key spline with the given control points. The points are
not validated here; see is_valid.
parse
fn parse(value: &str) -> Result<Ref<KeySpline>, FormatError>
Parses a key spline from four numbers.
control_point_x1
fn control_point_x1(self: &Self) -> f64
X coordinate of the first control point.
set_control_point_x1
fn set_control_point_x1(self: &Self, value: f64)
Sets the X coordinate of the first control point. Panics when the
value is outside [0, 1].
control_point_y1
fn control_point_y1(self: &Self) -> f64
Y coordinate of the first control point.
set_control_point_y1
fn set_control_point_y1(self: &Self, value: f64)
control_point_x2
fn control_point_x2(self: &Self) -> f64
X coordinate of the second control point.
set_control_point_x2
fn set_control_point_x2(self: &Self, value: f64)
Sets the X coordinate of the second control point. Panics when the
value is outside [0, 1].
control_point_y2
fn control_point_y2(self: &Self) -> f64
Y coordinate of the second control point.
set_control_point_y2
fn set_control_point_y2(self: &Self, value: f64)
get_spline_progress
fn get_spline_progress(self: &Self, linear_progress: f64) -> f64
Calculates the spline progress from a linear progress.
is_valid
fn is_valid(self: &Self) -> bool
Checks whether the spline control points are valid: both X values
within [0, 1].
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeFerroObjectImplExtClassDefaultsBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>ReceiverAnyErasedDestructorIntoEitherDerefUpcast<T>Upcast<KeySpline>StaticTypeObjectTypeSubclassable<T>DefaultConstructibleFerroObjectImpl
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.