SpringAnimation

class SpringAnimation(pointer: <Error class: unknown class><<Error class: unknown class>>) : Animation

A spring-based class@Animation.

AdwSpringAnimation 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

Link copied to clipboard
constructor(widget: <Error class: unknown class>, from: Double, to: Double, springParams: SpringParams, target: AnimationTarget)

Creates a new AdwSpringAnimation on @widget.

constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val adwAnimationPointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
val adwSpringAnimationPointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard

Whether the animation should be clamped.

Link copied to clipboard

Precision of the spring.

Link copied to clipboard
val estimatedDuration: <Error class: unknown class>

Estimated duration of the animation, in milliseconds.

Link copied to clipboard

Whether to skip the animation when animations are globally disabled.

Link copied to clipboard

The initial velocity to start the animation with.

Link copied to clipboard

Physical parameters describing the spring.

Link copied to clipboard

The animation state.

Link copied to clipboard

The target to animate.

Link copied to clipboard
open val value: Double

The current value of the animation.

Link copied to clipboard

The value to animate from.

Link copied to clipboard

The value to animate to.

Link copied to clipboard

Current velocity of the animation.

Link copied to clipboard
open val widget: <Error class: unknown class>

The animation widget.

Functions

Link copied to clipboard
fun calculateValue(time: <Error class: unknown class>): Double

Calculates the value @self will have at @time.

Link copied to clipboard
fun calculateVelocity(time: <Error class: unknown class>): Double

Calculates the velocity @self will have at @time.

Link copied to clipboard
fun connectDone(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: () -> Unit): <Error class: unknown class>

This signal is emitted when the animation has been completed, either on its own or via calling method@Animation.skip.

Link copied to clipboard

Gets whether @self should be clamped.

Link copied to clipboard

Gets the precision of the spring.

Link copied to clipboard
fun getEstimatedDuration(): <Error class: unknown class>

Gets the estimated duration of @self, in milliseconds.

Link copied to clipboard

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

Link copied to clipboard

Gets the initial velocity of @self.

Link copied to clipboard

Gets the physical parameters of the spring of @self.

Link copied to clipboard

Gets the current value of @self.

Link copied to clipboard

Gets the target @self animates.

Link copied to clipboard
open fun getValue(): Double

Gets the current value of @self.

Link copied to clipboard

Gets the value @self will animate from.

Link copied to clipboard

Gets the value @self will animate to.

Link copied to clipboard

Gets the current velocity of @self.

Link copied to clipboard
open fun getWidget(): <Error class: unknown class>

Gets the widget @self was created for.

Link copied to clipboard
open fun pause()

Pauses a playing animation for @self.

Link copied to clipboard
open fun play()

Starts the animation for @self.

Link copied to clipboard
open fun reset()

Resets the animation for @self.

Link copied to clipboard
open fun resume()

Resumes a paused animation for @self.

Link copied to clipboard
fun setClamp(clamp: Boolean)

Sets whether @self should be clamped.

Link copied to clipboard
fun setEpsilon(epsilon: Double)

Sets the precision of the spring.

Link copied to clipboard

Sets whether to skip @self when animations are globally disabled.

Link copied to clipboard
fun setInitialVelocity(velocity: Double)

Sets the initial velocity of @self.

Link copied to clipboard
fun setSpringParams(springParams: SpringParams)

Sets the physical parameters of the spring of @self.

Link copied to clipboard
open fun setTarget(target: AnimationTarget)

Sets the target @self animates to @target.

Link copied to clipboard
fun setValueFrom(value: Double)

Sets the value @self will animate from.

Link copied to clipboard
fun setValueTo(value: Double)

Sets the value @self will animate to.

Link copied to clipboard
open fun skip()

Skips the animation for @self.