pub struct EffectTransition {
pub duration: Duration,
/* private fields */
}Expand description
A composable transition that applies concrete fade, slide, and size effects to an element.
This is distinct from crate::motion::Transition, which is a timing
policy for a caller-chosen value and never picks a visual property. Prefer
motion for new code.
§Example
ⓘ
EffectTransition::new(Duration::from_millis(150))
.ease(ease_out_cubic)
.slide_y(px(-4.), px(0.))
.fade(0.0, 1.0)
.apply(element, "enter-anim")Fields§
§duration: DurationImplementations§
Source§impl EffectTransition
impl EffectTransition
pub fn new(duration: Duration) -> EffectTransition
Sourcepub fn ease(self, easing: impl Fn(f32) -> f32 + 'static) -> EffectTransition
pub fn ease(self, easing: impl Fn(f32) -> f32 + 'static) -> EffectTransition
Set the easing function.
Sourcepub fn slide_y(self, from: Pixels, to: Pixels) -> EffectTransition
pub fn slide_y(self, from: Pixels, to: Pixels) -> EffectTransition
Animate vertical offset from from to to.
Sourcepub fn slide_x(self, from: Pixels, to: Pixels) -> EffectTransition
pub fn slide_x(self, from: Pixels, to: Pixels) -> EffectTransition
Animate horizontal offset from from to to.
Sourcepub fn fade(self, from: f32, to: f32) -> EffectTransition
pub fn fade(self, from: f32, to: f32) -> EffectTransition
Animate opacity from from to to.
Sourcepub fn width(self, from: Pixels, to: Pixels) -> EffectTransition
pub fn width(self, from: Pixels, to: Pixels) -> EffectTransition
Animate width from from to to.
Sourcepub fn height(self, from: Pixels, to: Pixels) -> EffectTransition
pub fn height(self, from: Pixels, to: Pixels) -> EffectTransition
Animate height from from to to.
Sourcepub fn apply<E>(
self,
element: E,
id: impl Into<ElementId>,
) -> AnimationElement<E>where
E: IntoElement + Styled + 'static,
pub fn apply<E>(
self,
element: E,
id: impl Into<ElementId>,
) -> AnimationElement<E>where
E: IntoElement + Styled + 'static,
Apply this transition to a Styled element, returning an AnimationElement.
Trait Implementations§
Source§impl Clone for EffectTransition
impl Clone for EffectTransition
Source§fn clone(&self) -> EffectTransition
fn clone(&self) -> EffectTransition
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 moreSource§impl FluentBuilder for EffectTransition
impl FluentBuilder for EffectTransition
Source§fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
Imperatively modify self with the given closure.
Source§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
Conditionally modify self with the given closure.
Source§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
Conditionally modify self with the given closure.
Auto Trait Implementations§
impl !RefUnwindSafe for EffectTransition
impl !Send for EffectTransition
impl !Sync for EffectTransition
impl !UnwindSafe for EffectTransition
impl Freeze for EffectTransition
impl Unpin for EffectTransition
impl UnsafeUnpin for EffectTransition
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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 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> ⓘ
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