pub struct AnimationSegment {
pub duration: f32,
pub anim_fn: for<'a> fn(&'a mut Ui, f32),
}Expand description
A single segment of the animation.
Defines the duration of a segment (in seconds), and a mutating function for
the [Ui]. See Animation for details on how to construct an animation function.
§Example
// A simple animation that fades the prior value out, and the new value in.
// Has a total time of `0.4` seconds with each segment taking a respective `0.2` seconds each.
const FADE_OUT: AnimationSegment = AnimationSegment::new(0.2, |ui, normal| ui.set_opacity(1.0 - normal));
const FADE_IN: AnimationSegment = AnimationSegment::new(0.2, |ui, normal| ui.set_opacity(normal));
const ANIM: Animation = Animation::from_segments(FADE_OUT, FADE_IN);Fields§
§duration: f32The duration of the animation, in seconds.
anim_fn: for<'a> fn(&'a mut Ui, f32)The [Ui] mutating function for the given f32 normal.
Implementations§
Trait Implementations§
Source§impl Clone for AnimationSegment
impl Clone for AnimationSegment
Source§fn clone(&self) -> AnimationSegment
fn clone(&self) -> AnimationSegment
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for AnimationSegment
Auto Trait Implementations§
impl Freeze for AnimationSegment
impl RefUnwindSafe for AnimationSegment
impl Send for AnimationSegment
impl Sync for AnimationSegment
impl Unpin for AnimationSegment
impl UnsafeUnpin for AnimationSegment
impl UnwindSafe for AnimationSegment
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
Mutably borrows from an owned value. Read more