pub struct Transition<'a, Message, Theme, Renderer, P>where
P: Program,{ /* private fields */ }Expand description
A widget that can be used to animate its contents.
Implementations§
Source§impl<'a, Message, Theme, Renderer, P> Transition<'a, Message, Theme, Renderer, P>where
Renderer: Renderer,
P: Program,
impl<'a, Message, Theme, Renderer, P> Transition<'a, Message, Theme, Renderer, P>where
Renderer: Renderer,
P: Program,
Sourcepub fn new<E>(
init: impl Fn() -> P + 'a,
value: P::Value,
view: impl Fn(&P, Instant) -> E + 'a,
) -> Selfwhere
E: Into<Element<'a, Message, Theme, Renderer>>,
pub fn new<E>(
init: impl Fn() -> P + 'a,
value: P::Value,
view: impl Fn(&P, Instant) -> E + 'a,
) -> Selfwhere
E: Into<Element<'a, Message, Theme, Renderer>>,
Creates a new Transition.
The init closure will be used to initialize an animation.
The view closure will receive the animation and an Instant, which can be used for interpolating values.
This will be called every frame until the given value is reached.
Sourcepub fn id(self, id: impl Into<Id>) -> Self
pub fn id(self, id: impl Into<Id>) -> Self
Sets the widget::Id of the Transition.
The widget::Id can subsequently be used to reset the [Animation] via reset.
Sourcepub fn key(self, key: impl Hash) -> Self
pub fn key(self, key: impl Hash) -> Self
Sets the key of the Transition widget for continuity.
Changing the key will reset the [Animation].
Sourcepub fn on_finish(self, on_finish: Message) -> Selfwhere
Message: Clone + 'a,
pub fn on_finish(self, on_finish: Message) -> Selfwhere
Message: Clone + 'a,
Sets the message that will be produced when the Transition has finished animating.
Note that if an [Animation] is set to loop forever, the message will never be produced!
Sourcepub fn on_finish_maybe(self, on_finish: impl Into<Option<Message>>) -> Selfwhere
Message: Clone + 'a,
pub fn on_finish_maybe(self, on_finish: impl Into<Option<Message>>) -> Selfwhere
Message: Clone + 'a,
Sets the message that will be produced when the Transition has finished animating, if Some.
Note that if an [Animation] is set to loop forever, the message will never be produced!
Sourcepub fn on_finish_with(self, on_finish: impl Fn() -> Message + 'a) -> Self
pub fn on_finish_with(self, on_finish: impl Fn() -> Message + 'a) -> Self
Sets the message that will be produced when the Transition has finished animating.
This is analogous to Transition::on_finish, but using a closure to produce
the message.
This closure will only be called when the Transition has actually finished animating and,
therefore, this method is useful to reduce overhead if creating the resulting
message is slow.
Note that if an [Animation] is set to loop forever, the message will never be produced!
Trait Implementations§
Source§impl<'a, Message, Theme, Renderer, P> From<Transition<'a, Message, Theme, Renderer, P>> for Element<'a, Message, Theme, Renderer>where
Message: 'a,
Theme: 'a,
Renderer: Renderer + 'a,
P: Program,
impl<'a, Message, Theme, Renderer, P> From<Transition<'a, Message, Theme, Renderer, P>> for Element<'a, Message, Theme, Renderer>where
Message: 'a,
Theme: 'a,
Renderer: Renderer + 'a,
P: Program,
Source§fn from(transition: Transition<'a, Message, Theme, Renderer, P>) -> Self
fn from(transition: Transition<'a, Message, Theme, Renderer, P>) -> Self
Source§impl<Message, Theme, Renderer, P> Widget<Message, Theme, Renderer> for Transition<'_, Message, Theme, Renderer, P>where
Renderer: Renderer,
P: Program,
impl<Message, Theme, Renderer, P> Widget<Message, Theme, Renderer> for Transition<'_, Message, Theme, Renderer, P>where
Renderer: Renderer,
P: Program,
Source§fn update(
&mut self,
tree: &mut Tree,
event: &Event,
layout: Layout<'_>,
cursor: Cursor,
renderer: &Renderer,
shell: &mut Shell<'_, Message>,
viewport: &Rectangle,
)
fn update( &mut self, tree: &mut Tree, event: &Event, layout: Layout<'_>, cursor: Cursor, renderer: &Renderer, shell: &mut Shell<'_, Message>, viewport: &Rectangle, )
Source§fn draw(
&self,
tree: &Tree,
renderer: &mut Renderer,
theme: &Theme,
style: &Style,
layout: Layout<'_>,
cursor: Cursor,
viewport: &Rectangle,
)
fn draw( &self, tree: &Tree, renderer: &mut Renderer, theme: &Theme, style: &Style, layout: Layout<'_>, cursor: Cursor, viewport: &Rectangle, )
Widget] using the associated Renderer.Source§fn mouse_interaction(
&self,
tree: &Tree,
layout: Layout<'_>,
cursor: Cursor,
viewport: &Rectangle,
renderer: &Renderer,
) -> Interaction
fn mouse_interaction( &self, tree: &Tree, layout: Layout<'_>, cursor: Cursor, viewport: &Rectangle, renderer: &Renderer, ) -> Interaction
Auto Trait Implementations§
impl<'a, Message, Theme, Renderer, P> Freeze for Transition<'a, Message, Theme, Renderer, P>
impl<'a, Message, Theme, Renderer, P> !RefUnwindSafe for Transition<'a, Message, Theme, Renderer, P>
impl<'a, Message, Theme, Renderer, P> !Send for Transition<'a, Message, Theme, Renderer, P>
impl<'a, Message, Theme, Renderer, P> !Sync for Transition<'a, Message, Theme, Renderer, P>
impl<'a, Message, Theme, Renderer, P> Unpin for Transition<'a, Message, Theme, Renderer, P>
impl<'a, Message, Theme, Renderer, P> UnsafeUnpin for Transition<'a, Message, Theme, Renderer, P>
impl<'a, Message, Theme, Renderer, P> !UnwindSafe for Transition<'a, Message, Theme, Renderer, P>
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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.§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.§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.§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.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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