pub struct AnimatedIconData { /* private fields */ }Expand description
A mark that is drawn from a number: 0.0 is one state, 1.0 is the other, and
everything between is the way across.
It is Copy and costs nothing until AnimatedIconData::at is called. What comes
back from at is an ordinary IconData, so every widget that already takes an
icon takes a morphing one — an Icon, an
IconButton, a floating action button, a chip, a navigation
destination — with nothing added to any of them.
Implementations§
Source§impl AnimatedIconData
impl AnimatedIconData
Sourcepub const fn custom(draw: fn(f32) -> Path) -> AnimatedIconData
pub const fn custom(draw: fn(f32) -> Path) -> AnimatedIconData
A pair of the caller’s own: draw is handed a t in 0.0..=1.0 and returns the
outline for it, on the 24 × 24 grid, y downwards, filled by the non-zero rule.
A function pointer rather than a closure, so a pair stays a const and is
declared exactly where a bundled one would be.
use frus_core::{Path, Rect};
use frus_widgets::AnimatedIconData;
/// A bar that grows from nothing.
fn grow(t: f32) -> Path {
Path::rect(Rect::new(12.0 - 9.0 * t, 11.0, 18.0 * t, 2.0))
}
const GROW: AnimatedIconData = AnimatedIconData::custom(grow);
assert!(GROW.at(0.0).path().verbs().len() == GROW.at(1.0).path().verbs().len());Sourcepub const fn mirrored(self) -> AnimatedIconData
pub const fn mirrored(self) -> AnimatedIconData
The same pair, declared to carry a direction — turned round in a right-to-left
reading order, like IconData::mirrored. The whole
animation is mirrored, at every t, because a mark that points somewhere points
there all the way across.
Sourcepub const fn matches_text_direction(self) -> bool
pub const fn matches_text_direction(self) -> bool
Whether this pair is turned round for a right-to-left reading order.
Trait Implementations§
Source§impl Clone for AnimatedIconData
impl Clone for AnimatedIconData
Source§fn clone(&self) -> AnimatedIconData
fn clone(&self) -> AnimatedIconData
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for AnimatedIconData
Source§impl Debug for AnimatedIconData
impl Debug for AnimatedIconData
impl Eq for AnimatedIconData
Source§impl Hash for AnimatedIconData
impl Hash for AnimatedIconData
Auto Trait Implementations§
impl Freeze for AnimatedIconData
impl RefUnwindSafe for AnimatedIconData
impl Send for AnimatedIconData
impl Sync for AnimatedIconData
impl Unpin for AnimatedIconData
impl UnsafeUnpin for AnimatedIconData
impl UnwindSafe for AnimatedIconData
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.