Struct components::engine::d2::animation::AnimatedFloat
source · [−]pub struct AnimatedFloat { /* private fields */ }
Expand description
A Float value that may be animated over time.
Implementations
sourceimpl AnimatedFloat
impl AnimatedFloat
pub fn new(
value: f32,
listener: Option<Rc<dyn Fn(&f32, &f32) + 'static>>
) -> AnimatedFloat
pub fn get(&self) -> f32
pub fn set(&self, value: f32)
pub fn update(&self, dt: f32)
sourcepub fn animate(
&self,
from: f32,
to: f32,
seconds: f32,
easing: Option<Rc<dyn Fn(f32) + 'static>>
)
pub fn animate(
&self,
from: f32,
to: f32,
seconds: f32,
easing: Option<Rc<dyn Fn(f32) + 'static>>
)
Animates between the two given values.
@param from The initial value.
@param to The target value.
@param seconds The animation duration, in seconds.
@param easing The easing fn to use, defaults to Ease.linear
.
sourcepub fn animate_to(
&self,
to: f32,
seconds: f32,
easing: Option<Rc<dyn Fn(f32) + 'static>>
)
pub fn animate_to(
&self,
to: f32,
seconds: f32,
easing: Option<Rc<dyn Fn(f32) + 'static>>
)
Animates between the current value and the given value.
@param to The target value.
@param seconds The animation duration, in seconds.
@param easing The easing fn to use, defaults to Ease.linear
.
sourcepub fn animate_by(
&self,
by: f32,
seconds: f32,
easing: Option<Rc<dyn Fn(f32) + 'static>>
)
pub fn animate_by(
&self,
by: f32,
seconds: f32,
easing: Option<Rc<dyn Fn(f32) + 'static>>
)
Animates the current value by the given delta.
@param by The delta added to the current value to get the target value.
@param seconds The animation duration, in seconds.
@param easing The easing fn to use, defaults to Ease.linear
.
pub fn bind_to(
&self,
to: Value<f32>,
function: Option<Box<dyn Fn(f32) + 'static, Global>>
)
pub fn set_behavior(&self, behavior: Option<Rc<dyn Behavior + 'static>>)
pub fn behavior(&self) -> Option<Rc<dyn Behavior + 'static>>
Trait Implementations
sourceimpl Clone for AnimatedFloat
impl Clone for AnimatedFloat
sourcefn clone(&self) -> AnimatedFloat
fn clone(&self) -> AnimatedFloat
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for AnimatedFloat
impl Debug for AnimatedFloat
sourceimpl Default for AnimatedFloat
impl Default for AnimatedFloat
sourcefn default() -> AnimatedFloat
fn default() -> AnimatedFloat
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl !RefUnwindSafe for AnimatedFloat
impl !Send for AnimatedFloat
impl !Sync for AnimatedFloat
impl Unpin for AnimatedFloat
impl !UnwindSafe for AnimatedFloat
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<'a, T, C, M> Inspect<'a, C, &'a C, M> for T
impl<'a, T, C, M> Inspect<'a, C, &'a C, M> for T
impl<'a, T, C, M> Inspect<'a, C, &'a mut C, M> for T
impl<'a, T, C, M> Inspect<'a, C, &'a mut C, M> for T
impl<Fr, To> IntoColor<To> for Fr where
To: FromColor<Fr>,
impl<Fr, To> IntoColor<To> for Fr where
To: FromColor<Fr>,
fn into_color(self) -> To
fn into_color(self) -> To
Convert into color
impl<T> Pointable for T
impl<T> Pointable for T
impl<T> SetParameter for T
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
Sets value
as a parameter of self
.