Skip to main content

Animation

Struct Animation 

Source
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

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

One frame of a thick ring blinking on and off.

This is the effect markers have always used, factored out of the widget so it can be selected and reused like any other. time is the frame time in seconds.

Source

pub fn orbit( painter: &Painter, center: Pos2, zoom: f32, time: f32, color: Color32, )

One frame of a dot orbiting the node, with a faint guide ring.

Reads as “under observation”. time is the frame time in seconds.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more