pub struct SSRuntimeEffectSlot { /* private fields */ }Expand description
JS-friendly wrapper of EffectSlot. Same conceptual flow as the C FFI:
- construct via
create, 2) callstepper frame with the resolved active event and timing, 3) readget_draw_plan_buf/get_draw_plan_lenonly whenstepreturnedtrueand only before the next call.
Implementations§
Source§impl SSRuntimeEffectSlot
impl SSRuntimeEffectSlot
pub fn create( resource: &SSRuntimeResource, effect_name_hash: u32, seed: u32, ) -> Result<SSRuntimeEffectSlot, JsValue>
Sourcepub fn step(
&mut self,
ev: &WebEffectEventInfo,
parent_frame: f32,
delta_seconds: f32,
fps: f32,
parent_looped: bool,
y_flip: bool,
vert_stride: u8,
draw: bool,
) -> bool
pub fn step( &mut self, ev: &WebEffectEventInfo, parent_frame: f32, delta_seconds: f32, fps: f32, parent_looped: bool, y_flip: bool, vert_stride: u8, draw: bool, ) -> bool
Advance one frame. ev is the event info returned by
SSRuntimeContext::get_active_effect_event (or built manually via
WebEffectEventInfo).
y_flip = true for Y-down rendering (pixi.js), mirroring each particle’s Y
position, rotation sign and quad; vert_stride = 2 packs
(x,y) verts, 3 packs (x,y,0) for engines requiring 3-component verts.
draw is whether the part is in this frame’s draw_order: a hidden
part steps with false, which moves its clock and builds no plan. Pass
true when stepping before this frame’s draw_order is known.
Returns true if visible; on true callers read the plan via
get_draw_plan_buf / get_draw_plan_len before the next step.
pub fn get_draw_plan_buf(&self) -> *const u8
pub fn get_draw_plan_len(&self) -> usize
pub fn get_seed(&self) -> u32
pub fn is_independent(&self) -> bool
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Reset the slot’s playback / “last started key” memory to its just-created
state without destroying it. Call on an explicit head-out (replay) so a
re-played animation re-fires its effect from scratch instead of debouncing
the first key as the same one the slot last started. Mirrors the C-API
ss_effect_slot_reset.
Trait Implementations§
Source§impl From<SSRuntimeEffectSlot> for JsValue
impl From<SSRuntimeEffectSlot> for JsValue
Source§fn from(value: SSRuntimeEffectSlot) -> Self
fn from(value: SSRuntimeEffectSlot) -> Self
Source§impl FromWasmAbi for SSRuntimeEffectSlot
impl FromWasmAbi for SSRuntimeEffectSlot
Source§impl IntoWasmAbi for SSRuntimeEffectSlot
impl IntoWasmAbi for SSRuntimeEffectSlot
Source§impl LongRefFromWasmAbi for SSRuntimeEffectSlot
impl LongRefFromWasmAbi for SSRuntimeEffectSlot
Source§type Abi = WasmPtr<WasmRefCell<SSRuntimeEffectSlot>>
type Abi = WasmPtr<WasmRefCell<SSRuntimeEffectSlot>>
RefFromWasmAbi::AbiSource§type Anchor = RcRef<SSRuntimeEffectSlot>
type Anchor = RcRef<SSRuntimeEffectSlot>
RefFromWasmAbi::AnchorSource§unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor
unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor
RefFromWasmAbi::ref_from_abiSource§impl RefFromWasmAbi for SSRuntimeEffectSlot
impl RefFromWasmAbi for SSRuntimeEffectSlot
Source§type Abi = WasmPtr<WasmRefCell<SSRuntimeEffectSlot>>
type Abi = WasmPtr<WasmRefCell<SSRuntimeEffectSlot>>
Self are recovered from.Source§type Anchor = RcRef<SSRuntimeEffectSlot>
type Anchor = RcRef<SSRuntimeEffectSlot>
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 SSRuntimeEffectSlot
impl RefMutFromWasmAbi for SSRuntimeEffectSlot
Source§type Abi = WasmPtr<WasmRefCell<SSRuntimeEffectSlot>>
type Abi = WasmPtr<WasmRefCell<SSRuntimeEffectSlot>>
RefFromWasmAbi::AbiSource§type Anchor = RcRefMut<SSRuntimeEffectSlot>
type Anchor = RcRefMut<SSRuntimeEffectSlot>
RefFromWasmAbi::AnchorSource§unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
RefFromWasmAbi::ref_from_abiimpl SupportsConstructor for SSRuntimeEffectSlot
impl SupportsInstanceProperty for SSRuntimeEffectSlot
impl SupportsStaticProperty for SSRuntimeEffectSlot
Source§impl TryFromJsValue for SSRuntimeEffectSlot
impl TryFromJsValue for SSRuntimeEffectSlot
Source§fn try_from_js_value_ref(value: &JsValue) -> Option<Self>
fn try_from_js_value_ref(value: &JsValue) -> Option<Self>
Source§const NULLABLE: bool = false
const NULLABLE: bool = false
Self accepts null as a distinct value space, as
Nullable<T> does. An enclosing Option then passes null through
instead of reading it as None, so Option<T> is itself nullable
exactly when T is not. JsValue does not set this: it accepts
null as one value among all of them, not as a distinct space, and
Option<JsValue> reads it as None like the ABI does. This is the
JS-value side of NullableFromWasmAbi, which claims null at the
ABI.Source§impl VectorFromWasmAbi for SSRuntimeEffectSlot
impl VectorFromWasmAbi for SSRuntimeEffectSlot
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[SSRuntimeEffectSlot]>
Source§impl VectorIntoWasmAbi for SSRuntimeEffectSlot
impl VectorIntoWasmAbi for SSRuntimeEffectSlot
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[SSRuntimeEffectSlot]>) -> Self::Abi
Source§impl WasmDescribeVector for SSRuntimeEffectSlot
impl WasmDescribeVector for SSRuntimeEffectSlot
Auto Trait Implementations§
impl !Send for SSRuntimeEffectSlot
impl !Sync for SSRuntimeEffectSlot
impl Freeze for SSRuntimeEffectSlot
impl RefUnwindSafe for SSRuntimeEffectSlot
impl Unpin for SSRuntimeEffectSlot
impl UnsafeUnpin for SSRuntimeEffectSlot
impl UnwindSafe for SSRuntimeEffectSlot
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
Source§impl<T> MaybeFromWasmAbi for Twhere
T: OptionFromWasmAbi,
impl<T> MaybeFromWasmAbi for Twhere
T: OptionFromWasmAbi,
Source§type MaybeAbi = <T as FromWasmAbi>::Abi
type MaybeAbi = <T as FromWasmAbi>::Abi
Option<Self>.Source§unsafe fn from_maybe_abi(js: <T as FromWasmAbi>::Abi) -> T
unsafe fn from_maybe_abi(js: <T as FromWasmAbi>::Abi) -> T
unsafe fn try_from_maybe_abi( js: <T as FromWasmAbi>::Abi, ) -> Result<T, &'static str>
Source§impl<T> MaybeIntoWasmAbi for Twhere
T: OptionIntoWasmAbi,
impl<T> MaybeIntoWasmAbi for Twhere
T: OptionIntoWasmAbi,
Source§type MaybeAbi = <T as IntoWasmAbi>::Abi
type MaybeAbi = <T as IntoWasmAbi>::Abi
Option<Self>.Source§fn into_maybe_abi(self) -> <T as IntoWasmAbi>::Abi
fn into_maybe_abi(self) -> <T as IntoWasmAbi>::Abi
Option<Self> ABI.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
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.