pub struct RavenSprite { /* private fields */ }Expand description
The signature effect. A stylized raven ๐ฆ (painted from shapes โ no asset
dependency, so it never goes missing) that flies in along a bezier arc with
ease-out and perches on a target egui::Rect, then idle-bobs.
Motion is deterministic given (start, target, elapsed) โ thatโs what
makes RavenSprite::pos_at unit-testable. The egui-driven loop is:
raven.update(ctx); // reads ctx.input(i.time), requests a repaint while flying
raven.paint(&painter); // draws the bird at its current posImplementationsยง
Sourceยงimpl RavenSprite
impl RavenSprite
Sourcepub fn from(self, start: Pos2) -> Self
pub fn from(self, start: Pos2) -> Self
Launch point of the flight (defaults to off-screen top-left).
Sourcepub fn color(self, color: Color32) -> Self
pub fn color(self, color: Color32) -> Self
Raven body colour (override the default near-black, e.g. for hugin_noir
you might tint the beak/eye via accent separately).
Sourcepub fn fly_to(self, target: Rect) -> Self
pub fn fly_to(self, target: Rect) -> Self
Aim the raven at target: it will perch centred on the top edge of
the rect (like landing on a table row). Resets the flight clock.
Sourcepub fn pos_at(&self, elapsed: f32) -> Pos2
pub fn pos_at(&self, elapsed: f32) -> Pos2
Deterministic position at elapsed seconds since launch โ the testable
core. Eases along the bezier arc with easing::ease_out_back (a
confident landing), holds the perch afterwards. Adds a subtle idle bob
once perched.
Sourcepub fn is_perched(&self) -> bool
pub fn is_perched(&self) -> bool
True once the flight is over (raven is perched, idle-bobbing).
Sourcepub fn update(&mut self, ctx: &Context)
pub fn update(&mut self, ctx: &Context)
Drive the animation from the egui clock. Pins the launch time on first
call, advances current, and request_repaints while still in flight so
the animation keeps ticking. Call once per frame before [paint].
Trait Implementationsยง
Sourceยงimpl Clone for RavenSprite
impl Clone for RavenSprite
Sourceยงfn clone(&self) -> RavenSprite
fn clone(&self) -> RavenSprite
1.0.0 (const: unstable) ยท Sourceยงfn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementationsยง
impl Freeze for RavenSprite
impl RefUnwindSafe for RavenSprite
impl Send for RavenSprite
impl Sync for RavenSprite
impl Unpin for RavenSprite
impl UnsafeUnpin for RavenSprite
impl UnwindSafe for RavenSprite
Blanket Implementationsยง
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Sourceยงimpl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Sourceยงimpl<T> IntoEither for T
impl<T> IntoEither for T
Sourceยงfn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSourceยงfn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more