flipbook
Generated Rust API reference for byte_engine.
byte_engine / animation / flipbook
Module flipbook
Play ordered image sequences at a fixed frame rate.
Create a Flipbook from image identifiers or handles, then call
Flipbook::frame with elapsed playback time. The caller owns the clock,
so pausing, restarting, and choosing an idle image stay at the gameplay layer.
Quick Reference
| Item | Kind | Description |
|---|---|---|
Flipbook | struct | The Flipbook struct provides allocation-free playback of a borrowed image sequence. |
Structs
Flipbook<'a, Image>
struct Flipbook<'a, Image> {
// [REDACTED: Private Fields]
}Defined in crates/byte-engine/src/animation/flipbook.rs:22-25
The Flipbook struct provides allocation-free playback of a borrowed image sequence.
Images may be resource paths, loaded handles, or another renderer's image
identifiers. Load Self::images before playback, then use Self::frame
to choose the image to draw. Sampling loops and does not load resources.
use byte_engine::{animation::flipbook::Flipbook, time::MediaTime};
let run = Flipbook::new(12, &["run0.png", "run1.png", "run2.png"]);
assert_eq!(*run.frame(MediaTime::from_frames(1, 12).unwrap()), "run1.png");Implementations
-
const fn new(frames_per_second: u32, images: &'a [Image]) -> SelfCreates a looping sequence. Next, sample it with
Self::frame.Panics
Panics if
imagesis empty orframes_per_secondis zero. -
const fn images(&self) -> &'a [Image]Returns the ordered images to load before playback.
-
const fn frames_per_second(&self) -> u32Returns the configured number of images displayed per second.
-
fn frame_index(&self, elapsed: MediaTime) -> usizeRelated:
MediaTimeSelects the looping frame at
elapsed, wrapping negative time backward. -
fn frame(&self, elapsed: MediaTime) -> &'a ImageRelated:
MediaTimeReturns the image at
elapsed; skipped updates do not slow playback.
Trait Implementations
impl ArchivePointee for Flipbook<'a, Image>
-
type ArchivedMetadata = () -
fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for Flipbook<'a, Image>
impl<Image: clone::Clone> Clone for Flipbook<'a, Image>
-
fn clone(&self) -> Flipbook<'a, Image>Related:
Flipbook
impl<Image: marker::Copy> Copy for Flipbook<'a, Image>
impl<Image: fmt::Debug> Debug for Flipbook<'a, Image>
-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
impl Downcast for Flipbook<'a, Image>
-
fn into_any(self: Box<T>) -> Box<dyn Any> -
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any> -
fn as_any(&self) -> &dyn Any -
fn as_any_mut(&mut self) -> &mut dyn Any
impl DowncastSync for Flipbook<'a, Image>
-
fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>
impl Instrument for Flipbook<'a, Image>
impl LayoutRaw for Flipbook<'a, Image>
-
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T, N1> Niching for Flipbook<'a, Image>
-
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool -
fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl<Image: cmp::PartialEq> PartialEq for Flipbook<'a, Image>
-
fn eq(&self, other: &Flipbook<'a, Image>) -> boolRelated:
Flipbook
impl Pointee for Flipbook<'a, Image>
-
type Metadata = ()