pub struct MotionPath { /* private fields */ }Expand description
Tween-driven motion path.
Implementations§
Source§impl MotionPath
impl MotionPath
Sourcepub fn new(svg_path: &str, duration: f32) -> Result<Self, JsValue>
pub fn new(svg_path: &str, duration: f32) -> Result<Self, JsValue>
Create a motion path from an SVG d string.
Sourcepub fn line(
from_x: f32,
from_y: f32,
to_x: f32,
to_y: f32,
duration: f32,
) -> Self
pub fn line( from_x: f32, from_y: f32, to_x: f32, to_y: f32, duration: f32, ) -> Self
Create a straight-line motion path.
Sourcepub fn to_array(&self) -> Float32Array
pub fn to_array(&self) -> Float32Array
Current position as a typed array.
Sourcepub fn rotation_deg(&self) -> f32
pub fn rotation_deg(&self) -> f32
Current auto-rotation heading in degrees.
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Whether the motion tween is complete.
Sourcepub fn set_auto_rotate(&self, yes: bool)
pub fn set_auto_rotate(&self, yes: bool)
Enable or disable auto-rotation.
Sourcepub fn set_offsets(&self, start: f32, end: f32)
pub fn set_offsets(&self, start: f32, end: f32)
Set normalized path offsets.
Sourcepub fn draw_on(&self, progress: f32) -> Float32Array
pub fn draw_on(&self, progress: f32) -> Float32Array
SVG draw values as [dashArray, dashOffset, progress].
Sourcepub fn draw_on_reverse(&self, progress: f32) -> Float32Array
pub fn draw_on_reverse(&self, progress: f32) -> Float32Array
SVG reverse draw values as [dashArray, dashOffset, progress].
Sourcepub fn total_length(&self) -> f32
pub fn total_length(&self) -> f32
Total path length.
Trait Implementations§
Source§impl Clone for MotionPath
impl Clone for MotionPath
Source§fn clone(&self) -> MotionPath
fn clone(&self) -> MotionPath
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 MotionPath
impl Debug for MotionPath
Source§impl From<MotionPath> for JsValue
impl From<MotionPath> for JsValue
Source§fn from(value: MotionPath) -> Self
fn from(value: MotionPath) -> Self
Converts to this type from the input type.
Source§impl FromWasmAbi for MotionPath
impl FromWasmAbi for MotionPath
Source§impl IntoWasmAbi for MotionPath
impl IntoWasmAbi for MotionPath
Source§impl LongRefFromWasmAbi for MotionPath
impl LongRefFromWasmAbi for MotionPath
Source§type Abi = WasmPtr<WasmRefCell<MotionPath>>
type Abi = WasmPtr<WasmRefCell<MotionPath>>
Same as
RefFromWasmAbi::AbiSource§type Anchor = RcRef<MotionPath>
type Anchor = RcRef<MotionPath>
Same as
RefFromWasmAbi::AnchorSource§unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor
unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor
Same as
RefFromWasmAbi::ref_from_abiSource§impl OptionFromWasmAbi for MotionPath
impl OptionFromWasmAbi for MotionPath
Source§impl OptionIntoWasmAbi for MotionPath
impl OptionIntoWasmAbi for MotionPath
Source§impl RefFromWasmAbi for MotionPath
impl RefFromWasmAbi for MotionPath
Source§type Abi = WasmPtr<WasmRefCell<MotionPath>>
type Abi = WasmPtr<WasmRefCell<MotionPath>>
The Wasm ABI type references to
Self are recovered from.Source§type Anchor = RcRef<MotionPath>
type Anchor = RcRef<MotionPath>
The type that holds the reference to
Self for the duration of the
invocation of the function that has an &Self parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.Source§impl RefMutFromWasmAbi for MotionPath
impl RefMutFromWasmAbi for MotionPath
Source§type Abi = WasmPtr<WasmRefCell<MotionPath>>
type Abi = WasmPtr<WasmRefCell<MotionPath>>
Same as
RefFromWasmAbi::AbiSource§type Anchor = RcRefMut<MotionPath>
type Anchor = RcRefMut<MotionPath>
Same as
RefFromWasmAbi::AnchorSource§unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
Same as
RefFromWasmAbi::ref_from_abiSource§impl TryFromJsValue for MotionPath
impl TryFromJsValue for MotionPath
Source§impl VectorFromWasmAbi for MotionPath
impl VectorFromWasmAbi for MotionPath
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[MotionPath]>
Source§impl VectorIntoWasmAbi for MotionPath
impl VectorIntoWasmAbi for MotionPath
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[MotionPath]>) -> Self::Abi
Source§impl WasmDescribeVector for MotionPath
impl WasmDescribeVector for MotionPath
impl SupportsConstructor for MotionPath
impl SupportsInstanceProperty for MotionPath
impl SupportsStaticProperty for MotionPath
Auto Trait Implementations§
impl Freeze for MotionPath
impl RefUnwindSafe for MotionPath
impl Send for MotionPath
impl Sync for MotionPath
impl Unpin for MotionPath
impl UnsafeUnpin for MotionPath
impl UnwindSafe for MotionPath
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
Same as
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.