pub struct Clip { /* private fields */ }Expand description
An animation: frames shown one after another, looping or once.
Implementations§
Source§impl Clip
impl Clip
Sourcepub fn new(frames: Vec<ClipFrame>, playback: Playback) -> Self
pub fn new(frames: Vec<ClipFrame>, playback: Playback) -> Self
A clip of frames, in order.
§Panics
If there are no frames, if a frame lasts zero, or if the frames
together last longer than a Duration can hold: see
Clip::try_new.
Sourcepub fn try_new(
frames: Vec<ClipFrame>,
playback: Playback,
) -> Result<Self, ClipError>
pub fn try_new( frames: Vec<ClipFrame>, playback: Playback, ) -> Result<Self, ClipError>
A clip of frames, in order, as Clip::new makes it.
§Errors
ClipError::NoFrames, ClipError::FrameLastsZero or
ClipError::TooLong.
Sourcepub fn duration(&self) -> Duration
pub fn duration(&self) -> Duration
How long the clip lasts, once through: its frames’ durations added.
Sourcepub fn frame_at(&self, elapsed: Duration) -> usize
pub fn frame_at(&self, elapsed: Duration) -> usize
The index of the frame shown elapsed after the clip started. A
frame shows from where the one before it ends, up to but not at its
own end. A looping clip starts again at each multiple of its
duration; a clip that plays once shows its last frame from its end
on.
Trait Implementations§
impl StructuralPartialEq for Clip
Auto Trait Implementations§
impl Forget for Clip
impl Freeze for Clip
impl Move for Clip
impl RefUnwindSafe for Clip
impl Send for Clip
impl Sync for Clip
impl Unpin for Clip
impl UnsafeUnpin for Clip
impl UnwindSafe for Clip
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