pub struct ScrollAnimation {
pub points_per_second: f32,
pub duration: Rangef,
}Expand description
Scroll animation configuration, used when programmatically scrolling somewhere (e.g. with [crate::Ui::scroll_to_cursor]).
The animation duration is calculated based on the distance to be scrolled via [ScrollAnimation::points_per_second]
and can be clamped to a min / max duration via [ScrollAnimation::duration].
Fields§
§points_per_second: f32With what speed should we scroll? (Default: 1000.0)
duration: RangefThe min / max scroll duration.
Implementations§
Source§impl ScrollAnimation
impl ScrollAnimation
Sourcepub fn new(points_per_second: f32, duration: Rangef) -> ScrollAnimation
pub fn new(points_per_second: f32, duration: Rangef) -> ScrollAnimation
New scroll animation
Sourcepub fn none() -> ScrollAnimation
pub fn none() -> ScrollAnimation
No animation, scroll instantly.
Sourcepub fn duration(t: f32) -> ScrollAnimation
pub fn duration(t: f32) -> ScrollAnimation
Scroll with a fixed duration, regardless of distance.
pub fn ui(&mut self, ui: &mut Ui)
Trait Implementations§
Source§impl Clone for ScrollAnimation
impl Clone for ScrollAnimation
Source§fn clone(&self) -> ScrollAnimation
fn clone(&self) -> ScrollAnimation
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 ScrollAnimation
Source§impl Debug for ScrollAnimation
impl Debug for ScrollAnimation
Source§impl Default for ScrollAnimation
impl Default for ScrollAnimation
Source§fn default() -> ScrollAnimation
fn default() -> ScrollAnimation
Returns the “default value” for a type. Read more
Source§impl PartialEq for ScrollAnimation
impl PartialEq for ScrollAnimation
impl StructuralPartialEq for ScrollAnimation
Auto Trait Implementations§
impl Forget for ScrollAnimation
impl Freeze for ScrollAnimation
impl Move for ScrollAnimation
impl RefUnwindSafe for ScrollAnimation
impl Send for ScrollAnimation
impl Sync for ScrollAnimation
impl Unpin for ScrollAnimation
impl UnsafeUnpin for ScrollAnimation
impl UnwindSafe for ScrollAnimation
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
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> 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