adw.spring_animation

Module for [SpringAnimation] class

Types 3

A spring-based class@Animation.

[adw.spring_animation.SpringAnimation] implements an animation driven by a physical model of a spring described by struct@SpringParams, with a resting position in property@SpringAnimation:value-to, stretched to property@SpringAnimation:value-from.

Since the animation is physically simulated, spring animations don't have a fixed duration. The animation will stop when the simulated spring comes to a rest - when the amplitude of the oscillations becomes smaller than property@SpringAnimation:epsilon, or immediately when it reaches property@SpringAnimation:value-to if property@SpringAnimation:clamp is set to TRUE. The estimated duration can be obtained with property@SpringAnimation:estimated-duration.

Due to the nature of spring-driven motion the animation can overshoot property@SpringAnimation:value-to before coming to a rest. Whether the animation will overshoot or not depends on the damping ratio of the spring. See struct@SpringParams for more information about specific damping ratio values.

If property@SpringAnimation:clamp is TRUE, the animation will abruptly end as soon as it reaches the final value, preventing overshooting.

Animations can have an initial velocity value, set via property@SpringAnimation:initial-velocity, which adjusts the curve without changing the duration. This makes spring animations useful for deceleration at the end of gestures.

If the initial and final values are equal, and the initial velocity is not 0, the animation value will bounce and return to its resting position.

Methods
GType _gType() @property
SpringAnimation self()Returns `this`, for use in `with` statements.
SpringAnimationGidBuilder builder()Get builder for [adw.spring_animation.SpringAnimation] Returns: New builder object
bool clamp() @propertyGet `clamp` property. Returns: Whether the animation should be clamped.
void clamp(bool propval) @propertySet `clamp` property. Params: propval = Whether the animation should be clamped.
double epsilon() @propertyGet `epsilon` property. Returns: Precision of the spring.
void epsilon(double propval) @propertySet `epsilon` property. Params: propval = Precision of the spring.
uint estimatedDuration() @propertyGet `estimatedDuration` property. Returns: Estimated duration of the animation, in milliseconds.
double initialVelocity() @propertyGet `initialVelocity` property. Returns: The initial velocity to start the animation with.
void initialVelocity(double propval) @propertySet `initialVelocity` property. Params: propval = The initial velocity to start the animation with.
adw.spring_params.SpringParams springParams() @propertyGet `springParams` property. Returns: Physical parameters describing the spring.
void springParams(adw.spring_params.SpringParams propval) @propertySet `springParams` property. Params: propval = Physical parameters describing the spring.
double valueFrom() @propertyGet `valueFrom` property. Returns: The value to animate from.
void valueFrom(double propval) @propertySet `valueFrom` property. Params: propval = The value to animate from.
double valueTo() @propertyGet `valueTo` property. Returns: The value to animate to.
void valueTo(double propval) @propertySet `valueTo` property. Params: propval = The value to animate to.
double velocity() @propertyGet `velocity` property. Returns: Current velocity of the animation.
double calculateValue(uint time)Calculates the value self will have at time.
double calculateVelocity(uint time)Calculates the velocity self will have at time.
bool getClamp()Gets whether self should be clamped. Returns: whether self is clamped
double getEpsilon()Gets the precision of the spring. Returns: the epsilon value
uint getEstimatedDuration()Gets the estimated duration of self, in milliseconds.
double getInitialVelocity()Gets the initial velocity of self. Returns: the initial velocity
adw.spring_params.SpringParams getSpringParams()Gets the physical parameters of the spring of self. Returns: the spring parameters
double getValueFrom()Gets the value self will animate from. Returns: the value to animate from
double getValueTo()Gets the value self will animate to. Returns: the value to animate to
double getVelocity()Gets the current velocity of self. Returns: the current velocity
void setClamp(bool clamp)Sets whether self should be clamped.
void setEpsilon(double epsilon)Sets the precision of the spring.
void setInitialVelocity(double velocity)Sets the initial velocity of self.
void setSpringParams(adw.spring_params.SpringParams springParams)Sets the physical parameters of the spring of self.
void setValueFrom(double value)Sets the value self will animate from.
void setValueTo(double value)Sets the value self will animate to.
Constructors
this(void * ptr, Flag!"Take" take)
this(gtk.widget.Widget widget, double from, double to, adw.spring_params.SpringParams springParams, adw.animation_target.AnimationTarget target)Creates a new [adw.spring_animation.SpringAnimation] on widget.
Methods
T clamp(bool propval)Set `clamp` property. Params: propval = Whether the animation should be clamped.
T epsilon(double propval)Set `epsilon` property. Params: propval = Precision of the spring.
T initialVelocity(double propval)Set `initialVelocity` property. Params: propval = The initial velocity to start the animation with.
T springParams(adw.spring_params.SpringParams propval)Set `springParams` property. Params: propval = Physical parameters describing the spring. Returns: Builder instance for fluent chaining
T valueFrom(double propval)Set `valueFrom` property. Params: propval = The value to animate from.
T valueTo(double propval)Set `valueTo` property. Params: propval = The value to animate to.

Fluent builder for [adw.spring_animation.SpringAnimation]