pub struct Animation {}Expand description
Factory for the built-in node animations.
See the module docs for the difference between the event-driven and persistent families.
Implementations§
Source§impl Animation
impl Animation
Sourcepub fn pulse(
painter: &Painter,
center: Pos2,
zoom: f32,
initial_time: Instant,
color: Color32,
) -> bool
pub fn pulse( painter: &Painter, center: Pos2, zoom: f32, initial_time: Instant, color: Color32, ) -> bool
One frame of an expanding, fading disc centred on center.
Reads as “one thing happened here”. Plays for PULSE_DURATION.
Returns true while still playing.
Sourcepub fn ripple(
painter: &Painter,
center: Pos2,
zoom: f32,
initial_time: Instant,
color: Color32,
) -> bool
pub fn ripple( painter: &Painter, center: Pos2, zoom: f32, initial_time: Instant, color: Color32, ) -> bool
One frame of three staggered expanding rings.
Where Animation::pulse reads as a single event, the repetition here
reads as “activity is ongoing”. Plays for RIPPLE_DURATION.
Returns true while still playing.
Sourcepub fn countdown_arc(
painter: &Painter,
center: Pos2,
zoom: f32,
initial_time: Instant,
color: Color32,
) -> bool
pub fn countdown_arc( painter: &Painter, center: Pos2, zoom: f32, initial_time: Instant, color: Color32, ) -> bool
One frame of a ring that empties clockwise from 12 o’clock.
The remaining arc is the remaining fraction of COUNTDOWN_DURATION,
which makes it a natural fit for “how old is this information”.
Returns true while still playing.
Sourcepub fn scale_in(
painter: &Painter,
center: Pos2,
zoom: f32,
initial_time: Instant,
color: Color32,
) -> bool
pub fn scale_in( painter: &Painter, center: Pos2, zoom: f32, initial_time: Instant, color: Color32, ) -> bool
One frame of a disc that grows past its final size and settles back.
Meant for nodes that just appeared. Plays for SCALE_IN_DURATION.
Returns true while still playing.
Sourcepub fn crosshair(
painter: &Painter,
center: Pos2,
zoom: f32,
initial_time: Instant,
color: Color32,
) -> bool
pub fn crosshair( painter: &Painter, center: Pos2, zoom: f32, initial_time: Instant, color: Color32, ) -> bool
One frame of four ticks converging onto the node.
Reads as “target acquired”; pairs well with selection. Plays for
CROSSHAIR_DURATION. Returns true while still playing.
Sourcepub fn flash_decay(
painter: &Painter,
a: Pos2,
b: Pos2,
zoom: f32,
initial_time: Instant,
color: Color32,
) -> bool
pub fn flash_decay( painter: &Painter, a: Pos2, b: Pos2, zoom: f32, initial_time: Instant, color: Color32, ) -> bool
One frame of a segment briefly thickening and brightening, then fading back to nothing.
The segment analogue of Animation::pulse: reads as “something
happened on this route”. Plays for FLASH_DECAY_DURATION. Returns
true while still playing.
Sourcepub fn comet_once(
painter: &Painter,
a: Pos2,
b: Pos2,
zoom: f32,
initial_time: Instant,
color: Color32,
direction: CometDirection,
) -> bool
pub fn comet_once( painter: &Painter, a: Pos2, b: Pos2, zoom: f32, initial_time: Instant, color: Color32, direction: CometDirection, ) -> bool
One frame of a single dot pass along the segment, then gone — the
event-driven counterpart to Animation::comet. direction picks
which endpoint it starts from. Plays for COMET_TRAVEL_DURATION.
Returns true while still playing.
Sourcepub fn wipe(
painter: &Painter,
a: Pos2,
b: Pos2,
zoom: f32,
initial_time: Instant,
color: Color32,
) -> bool
pub fn wipe( painter: &Painter, a: Pos2, b: Pos2, zoom: f32, initial_time: Instant, color: Color32, ) -> bool
One frame of the segment drawing itself in, from a towards b, then
gone. Reads as “this route was just established” — where
Animation::comet_once shows something moving along an existing
route, this shows the route itself appearing. Plays for
WIPE_DURATION. Returns true while still playing.
Cheaper than the mesh technique Animation::dash uses: the
progressively-revealed portion is still just a straight line, so a
plain line_segment from a to the interpolated point suffices.
Sourcepub fn comet(
painter: &Painter,
a: Pos2,
b: Pos2,
zoom: f32,
time: f32,
color: Color32,
)
pub fn comet( painter: &Painter, a: Pos2, b: Pos2, zoom: f32, time: f32, color: Color32, )
One frame of a dot travelling from a to b and looping back.
Reads as “this is the direction of flow”. time is the frame time in
seconds; one full pass takes COMET_PERIOD.
Sourcepub fn dash(
painter: &Painter,
a: Pos2,
b: Pos2,
zoom: f32,
time: f32,
color: Color32,
)
pub fn dash( painter: &Painter, a: Pos2, b: Pos2, zoom: f32, time: f32, color: Color32, )
One frame of a segment drawn as a dashed line whose pattern slides
along it (“marching ants”). time is the frame time in seconds; the
pattern repeats every DASH_PERIOD_PX screen pixels and slides at
DASH_SPEED repeats per second.
Two triangles textured with a small repeating strip (registered once
per egui::Context and reused after that), rather than one shape per
dash – see the module docs for why that matters at scale. A
zero-length segment is skipped.
Sourcepub fn glow_band(
painter: &Painter,
a: Pos2,
b: Pos2,
zoom: f32,
time: f32,
color: Color32,
)
pub fn glow_band( painter: &Painter, a: Pos2, b: Pos2, zoom: f32, time: f32, color: Color32, )
One frame of a localized band of brightness travelling the length of
the segment and looping. time is the frame time in seconds; one full
traverse-and-loop takes GLOW_BAND_PERIOD.
Reads as “flow”, calmer than Animation::dash’s marching pattern
– a single soft highlight rather than a repeating texture. Uses the
same textured-mesh technique as dash, but with a
TextureWrapMode::ClampToEdge sampler and a texture that is zero-alpha
at both edges: as the band’s mapped position slides past 0.0 or
1.0, sampling clamps to that zero-alpha edge texel, so the band
fades out before either endpoint instead of popping back in like
dash’s repeating pattern would. A zero-length segment is skipped.
Sourcepub fn chevrons(
painter: &Painter,
a: Pos2,
b: Pos2,
zoom: f32,
time: f32,
color: Color32,
)
pub fn chevrons( painter: &Painter, a: Pos2, b: Pos2, zoom: f32, time: f32, color: Color32, )
One frame of a row of arrow shapes sliding along the segment. time
is the frame time in seconds; the pattern repeats every
CHEVRON_PERIOD_PX screen pixels and slides at CHEVRON_SPEED
repeats per second.
Reads as “direction of travel”, more explicit at a glance than
Animation::comet’s single dot. Same mesh-building shape as
Animation::dash, but where dash samples a 1D texture at a
constant uv.y = 0.5 (its stripes don’t vary across the ribbon’s
width), the two long edges of this mesh get uv.y = 0.0 / 1.0
instead, so the interpolated uv.y sweeps across a genuinely 2D
texture and traces out the arrow shape. A zero-length segment is
skipped.
Sourcepub fn halo(
painter: &Painter,
center: Pos2,
zoom: f32,
time: f32,
color: Color32,
)
pub fn halo( painter: &Painter, center: Pos2, zoom: f32, time: f32, color: Color32, )
One frame of a ring whose opacity breathes in and out.
For lasting state — “you are here”, “this system is camped”. time
is the frame time in seconds (ui.input(|i| i.time)).
The radius has a floor in screen pixels so the halo does not vanish when the map is zoomed far out.
Auto Trait Implementations§
impl Freeze for Animation
impl RefUnwindSafe for Animation
impl Send for Animation
impl Sync for Animation
impl Unpin for Animation
impl UnsafeUnpin for Animation
impl UnwindSafe for Animation
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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