adw.spring_animation

Module for [SpringAnimation] class

Types 3

A spring-based adw.animation.Animation.

adw.spring_animation.SpringAnimation implements an animation driven by a physical model of a spring described by adw.spring_params.SpringParams, with a resting position in adw.spring_animation.SpringAnimation.valueTo, stretched to adw.spring_animation.SpringAnimation.valueFrom.

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 adw.spring_animation.SpringAnimation.epsilon, or immediately when it reaches adw.spring_animation.SpringAnimation.valueTo if adw.spring_animation.SpringAnimation.clamp is set to TRUE. The estimated duration can be obtained with adw.spring_animation.SpringAnimation.estimatedDuration.

Due to the nature of spring-driven motion the animation can overshoot adw.spring_animation.SpringAnimation.valueTo before coming to a rest. Whether the animation will overshoot or not depends on the damping ratio of the spring. See adw.spring_params.SpringParams for more information about specific damping ratio values.

If adw.spring_animation.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 adw.spring_animation.SpringAnimation.initialVelocity, 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 _getGType() static nothrow
GType _gType() @property nothrow
SpringAnimation self() nothrowReturns `this`, for use in `with` statements.
SpringAnimationGidBuilder builder() static nothrowGet builder for [adw.spring_animation.SpringAnimation] Returns: New builder object
bool clamp() @property nothrowGet `clamp` property. Returns: Whether the animation should be clamped.
void clamp(bool propval) @property nothrowSet `clamp` property. Params: propval = Whether the animation should be clamped.
double epsilon() @property nothrowGet `epsilon` property. Returns: Precision of the spring.
void epsilon(double propval) @property nothrowSet `epsilon` property. Params: propval = Precision of the spring.
uint estimatedDuration() @property nothrowGet `estimatedDuration` property. Returns: Estimated duration of the animation, in milliseconds.
double initialVelocity() @property nothrowGet `initialVelocity` property. Returns: The initial velocity to start the animation with.
void initialVelocity(double propval) @property nothrowSet `initialVelocity` property. Params: propval = The initial velocity to start the animation with.
adw.spring_params.SpringParams springParams() @property nothrowGet `springParams` property. Returns: Physical parameters describing the spring.
void springParams(adw.spring_params.SpringParams propval) @property nothrowSet `springParams` property. Params: propval = Physical parameters describing the spring.
double valueFrom() @property nothrowGet `valueFrom` property. Returns: The value to animate from.
void valueFrom(double propval) @property nothrowSet `valueFrom` property. Params: propval = The value to animate from.
double valueTo() @property nothrowGet `valueTo` property. Returns: The value to animate to.
void valueTo(double propval) @property nothrowSet `valueTo` property. Params: propval = The value to animate to.
double velocity() @property nothrowGet `velocity` property. Returns: Current velocity of the animation.
double calculateValue(uint time) nothrowCalculates the value self will have at time.
double calculateVelocity(uint time) nothrowCalculates the velocity self will have at time.
bool getClamp() nothrowGets whether self should be clamped. Returns: whether self is clamped
double getEpsilon() nothrowGets the precision of the spring. Returns: the epsilon value
uint getEstimatedDuration() nothrowGets the estimated duration of self, in milliseconds.
double getInitialVelocity() nothrowGets the initial velocity of self. Returns: the initial velocity
adw.spring_params.SpringParams getSpringParams() nothrowGets the physical parameters of the spring of self. Returns: the spring parameters
double getValueFrom() nothrowGets the value self will animate from. Returns: the value to animate from
double getValueTo() nothrowGets the value self will animate to. Returns: the value to animate to
double getVelocity() nothrowGets the current velocity of self. Returns: the current velocity
void setClamp(bool clamp) nothrowSets whether self should be clamped.
void setEpsilon(double epsilon) nothrowSets the precision of the spring.
void setInitialVelocity(double velocity) nothrowSets the initial velocity of self.
void setSpringParams(adw.spring_params.SpringParams springParams) nothrowSets the physical parameters of the spring of self.
void setValueFrom(double value) nothrowSets the value self will animate from.
void setValueTo(double value) nothrowSets 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.

Fluent builder implementation template for adw.spring_animation.SpringAnimation

Methods
T clamp(bool propval) nothrowSet `clamp` property. Params: propval = Whether the animation should be clamped.
T epsilon(double propval) nothrowSet `epsilon` property. Params: propval = Precision of the spring.
T initialVelocity(double propval) nothrowSet `initialVelocity` property. Params: propval = The initial velocity to start the animation with.
T springParams(adw.spring_params.SpringParams propval) nothrowSet `springParams` property. Params: propval = Physical parameters describing the spring. Returns: Builder instance for fluent chaining
T valueFrom(double propval) nothrowSet `valueFrom` property. Params: propval = The value to animate from.
T valueTo(double propval) nothrowSet `valueTo` property. Params: propval = The value to animate to.
Methods
SpringAnimation build() nothrowCreate object from builder. Returns: New object