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: <Error class: unknown class>, to: <Error class: unknown class>, 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
var epsilon: <Error class: unknown class>

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
var initialVelocity: <Error class: unknown class>

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: <Error class: unknown class>

The current value of the animation.

Link copied to clipboard
var valueFrom: <Error class: unknown class>

The value to animate from.

Link copied to clipboard
var valueTo: <Error class: unknown class>

The value to animate to.

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

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>): <Error class: unknown class>

Calculates the value @self will have at @time.

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

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
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
open fun skip()

Skips the animation for @self.