pub struct BrowserSession { /* private fields */ }Expand description
Lifecycle and clock of a browser view, independent of DOM object ownership.
Implementations§
Source§impl BrowserSession
impl BrowserSession
Sourcepub fn new(playing: bool) -> Self
pub fn new(playing: bool) -> Self
Create an inline, visible view with an available graphics context at time zero.
Sourcepub fn apply(&mut self, input: SessionInput) -> Result<(), BrowserError>
pub fn apply(&mut self, input: SessionInput) -> Result<(), BrowserError>
Apply a lifecycle input; suspension and clock-owner transitions reset the baseline.
§Errors
A seek to negative or non-finite time is rejected without changing state.
Sourcepub fn playing(&self) -> bool
pub fn playing(&self) -> bool
Whether authored animation is playing, including while temporarily suspended.
Sourcepub fn time_seconds(&self) -> f64
pub fn time_seconds(&self) -> f64
Current accepted scene time in seconds.
Sourcepub fn active(&self) -> bool
pub fn active(&self) -> bool
Whether the host may submit a frame in the current lifecycle state.
Sourcepub fn frame(&mut self, input: FrameInput) -> Result<FrameTiming, BrowserError>
pub fn frame(&mut self, input: FrameInput) -> Result<FrameTiming, BrowserError>
Validate and advance one frame. The first frame after a transition has zero delta.
§Errors
Rejects invalid or backwards timestamps, retaining the previous accepted state.
Sourcepub fn sample(
&mut self,
runtime: &Runtime,
input: FrameInput,
) -> Result<Option<Frame>, BrowserError>
pub fn sample( &mut self, runtime: &Runtime, input: FrameInput, ) -> Result<Option<Frame>, BrowserError>
Sample an SDK scene using this view’s clock, or return None while suspended.
§Errors
Invalid timestamps or rejected SDK frames leave the accepted clock unchanged.
Trait Implementations§
Source§impl Clone for BrowserSession
impl Clone for BrowserSession
Source§fn clone(&self) -> BrowserSession
fn clone(&self) -> BrowserSession
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more