SpringAnimation

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.

Constructors

this
this(void* ptr, Flag!"Take" take)
this
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.

Members

Functions

calculateValue
double calculateValue(uint time)

Calculates the value self will have at time.

calculateVelocity
double calculateVelocity(uint time)

Calculates the velocity self will have at time.

getClamp
bool getClamp()

Gets whether self should be clamped.

getEpsilon
double getEpsilon()

Gets the precision of the spring.

getEstimatedDuration
uint getEstimatedDuration()

Gets the estimated duration of self, in milliseconds.

getInitialVelocity
double getInitialVelocity()

Gets the initial velocity of self.

getSpringParams
adw.spring_params.SpringParams getSpringParams()

Gets the physical parameters of the spring of self.

getValueFrom
double getValueFrom()

Gets the value self will animate from.

getValueTo
double getValueTo()

Gets the value self will animate to.

getVelocity
double getVelocity()

Gets the current velocity of self.

self
SpringAnimation self()

Returns this, for use in with statements.

setClamp
void setClamp(bool clamp)

Sets whether self should be clamped.

setEpsilon
void setEpsilon(double epsilon)

Sets the precision of the spring.

setInitialVelocity
void setInitialVelocity(double velocity)

Sets the initial velocity of self.

setSpringParams
void setSpringParams(adw.spring_params.SpringParams springParams)

Sets the physical parameters of the spring of self.

setValueFrom
void setValueFrom(double value)

Sets the value self will animate from.

setValueTo
void setValueTo(double value)

Sets the value self will animate to.

Properties

_gType
GType _gType [@property getter]
clamp
bool clamp [@property getter]

Get clamp property.

clamp
bool clamp [@property setter]

Set clamp property.

epsilon
double epsilon [@property getter]

Get epsilon property.

epsilon
double epsilon [@property setter]

Set epsilon property.

estimatedDuration
uint estimatedDuration [@property getter]

Get estimatedDuration property.

initialVelocity
double initialVelocity [@property getter]

Get initialVelocity property.

initialVelocity
double initialVelocity [@property setter]

Set initialVelocity property.

springParams
adw.spring_params.SpringParams springParams [@property getter]

Get springParams property.

springParams
adw.spring_params.SpringParams springParams [@property setter]

Set springParams property.

valueFrom
double valueFrom [@property getter]

Get valueFrom property.

valueFrom
double valueFrom [@property setter]

Set valueFrom property.

valueTo
double valueTo [@property getter]

Get valueTo property.

valueTo
double valueTo [@property setter]

Set valueTo property.

velocity
double velocity [@property getter]

Get velocity property.

Static functions

_getGType
GType _getGType()

Inherited Members

From Animation

_getGType
GType _getGType()
_gType
GType _gType [@property getter]
self
Animation self()

Returns this, for use in with statements.

followEnableAnimationsSetting
bool followEnableAnimationsSetting [@property getter]

Get followEnableAnimationsSetting property.

followEnableAnimationsSetting
bool followEnableAnimationsSetting [@property setter]

Set followEnableAnimationsSetting property.

state
adw.types.AnimationState state [@property getter]

Get state property.

target
adw.animation_target.AnimationTarget target [@property getter]

Get target property.

target
adw.animation_target.AnimationTarget target [@property setter]

Set target property.

value
double value [@property getter]

Get value property.

getFollowEnableAnimationsSetting
bool getFollowEnableAnimationsSetting()

Gets whether self should be skipped when animations are globally disabled.

getState
adw.types.AnimationState getState()

Gets the current value of self.

getTarget
adw.animation_target.AnimationTarget getTarget()

Gets the target self animates.

getValue
double getValue()

Gets the current value of self.

getWidget
gtk.widget.Widget getWidget()

Gets the widget self was created for.

pause
void pause()

Pauses a playing animation for self.

play
void play()

Starts the animation for self.

reset
void reset()

Resets the animation for self.

resume
void resume()

Resumes a paused animation for self.

setFollowEnableAnimationsSetting
void setFollowEnableAnimationsSetting(bool setting)

Sets whether to skip self when animations are globally disabled.

setTarget
void setTarget(adw.animation_target.AnimationTarget target)

Sets the target self animates to target.

skip
void skip()

Skips the animation for self.

connectDone
ulong connectDone(T callback, Flag!"After" after)

Connect to Done signal.