#[non_exhaustive]pub struct ClipFrame {
pub texture: Handle<Texture>,
pub uv: Rect,
pub duration: Duration,
pub placement: Option<Placement>,
}Expand description
One frame of a Clip: a region of a texture, shown for duration,
and maybe the size and pivot of its quad.
Made with ClipFrame::new or ClipFrame::from_atlas outside this
crate, so that fields can be added later.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.texture: Handle<Texture>The texture, usually an atlas page.
uv: RectThe region of the texture, normalized, as Sprite::uv.
duration: DurationHow long the frame shows: more than zero.
placement: Option<Placement>The quad the frame is drawn as, which nadir::animate writes into
the Sprite with the texture and uv: a trimmed frame’s own size and
pivot. None leaves the Sprite’s size and pivot as they are, which
may be those that a frame of another clip wrote.
Implementations§
Source§impl ClipFrame
impl ClipFrame
Sourcepub const fn new(texture: Handle<Texture>, uv: Rect, duration: Duration) -> Self
pub const fn new(texture: Handle<Texture>, uv: Rect, duration: Duration) -> Self
The region uv of texture, shown for duration, in the quad the
Sprite already has.
Sourcepub fn from_atlas(
texture: Handle<Texture>,
sprite: &AtlasSprite,
frame: usize,
duration: Duration,
) -> Option<Self>
pub fn from_atlas( texture: Handle<Texture>, sprite: &AtlasSprite, frame: usize, duration: Duration, ) -> Option<Self>
Frame frame of sprite, from a cooked Atlas, in texture,
which must be the frame’s page, shown for duration: placed as
Sprite::from_atlas places it, its
trimmed size at one world unit a pixel, with the sprite’s pivot where
the untrimmed cell has it. So the frames of a clip, trimmed each to
its own pixels, show where the sheet drew them, and mirror about the
pivot. None if sprite has no such frame, or is a tile set.