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 more