Skip to main content

Ripples

Struct Ripples 

Source
pub struct Ripples { /* private fields */ }
Expand description

Every splash currently alive on one widget.

There can be several: a second tap does not cancel the first one’s fade, it starts its own circle beside it — which is what makes drumming on a surface look like water rather than a switch.

Implementations§

Source§

impl Ripples

Source

pub fn press(&mut self, origin: Point, size: Size)

A finger landed at origin, in the coordinates of a box of size.

Source

pub fn confirm(&mut self)

The tap completed. Only the splash still waiting for it is confirmed.

Source

pub fn cancel(&mut self)

The gesture ended without a tap: every waiting splash leaves.

Source

pub fn advance(&mut self, dt: f32) -> bool

Advances every splash, dropping the ones that have gone. Returns true while any is still moving.

Source

pub fn is_idle(&self) -> bool

Is there nothing left to draw?

Source

pub fn hash_state<H: Hasher>(&self, h: &mut H)

Folds the splashes’ motion into a hash — what the paint-boundary cache compares to notice that a cached surface no longer paints what it did last frame.

Source

pub fn paint( &self, owner: u64, bounds: Rect, radius: BorderRadius, color: Color, scene: &mut Scene, )

Paints the splashes into bounds, clipped to the box and its rounding.

The circles go into a composited layer whose shape erases whatever runs past the corners — the same machinery crate::ClipRRect uses, and the reason ink hugs a rounded button instead of squaring it off.

Trait Implementations§

Source§

impl Clone for Ripples

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Ripples

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Ripples

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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<Msg> IntoMsg<Msg> for Msg

Source§

fn defer(work: impl Fn() -> Msg + 'static) -> Msg

The message that stands for work’s result.
Source§

impl<T> MaybeSend for T
where T: Send,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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, !>

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.