gi-adwaita-1.0.3: Adwaita bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Adw.Objects.SpringAnimation

Description

A spring-based [classanimation].

AdwSpringAnimation implements an animation driven by a physical model of a spring described by [structspringParams], with a resting position in [propertyspringAnimation:value-to], stretched to [propertyspringAnimation: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 [propertyspringAnimation:epsilon], or immediately when it reaches [propertyspringAnimation:value-to] if [propertyspringAnimation:clamp] is set to TRUE. The estimated duration can be obtained with [propertyspringAnimation:estimated-duration].

Due to the nature of spring-driven motion the animation can overshoot [propertyspringAnimation:value-to] before coming to a rest. Whether the animation will overshoot or not depends on the damping ratio of the spring. See [structspringParams] for more information about specific damping ratio values.

If [propertyspringAnimation: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 [propertyspringAnimation: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.

Since: 1.0

Synopsis

Exported types

newtype SpringAnimation Source #

Memory-managed wrapper type.

Constructors

SpringAnimation (ManagedPtr SpringAnimation) 

Instances

Instances details
Eq SpringAnimation Source # 
Instance details

Defined in GI.Adw.Objects.SpringAnimation

GObject SpringAnimation Source # 
Instance details

Defined in GI.Adw.Objects.SpringAnimation

ManagedPtrNewtype SpringAnimation Source # 
Instance details

Defined in GI.Adw.Objects.SpringAnimation

TypedObject SpringAnimation Source # 
Instance details

Defined in GI.Adw.Objects.SpringAnimation

Methods

glibType :: IO GType

HasParentTypes SpringAnimation Source # 
Instance details

Defined in GI.Adw.Objects.SpringAnimation

IsGValue (Maybe SpringAnimation) Source #

Convert SpringAnimation to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Adw.Objects.SpringAnimation

Methods

gvalueGType_ :: IO GType

gvalueSet_ :: Ptr GValue -> Maybe SpringAnimation -> IO ()

gvalueGet_ :: Ptr GValue -> IO (Maybe SpringAnimation)

type ParentTypes SpringAnimation Source # 
Instance details

Defined in GI.Adw.Objects.SpringAnimation

type ParentTypes SpringAnimation = '[Animation, Object]

class (GObject o, IsDescendantOf SpringAnimation o) => IsSpringAnimation o Source #

Type class for types which can be safely cast to SpringAnimation, for instance with toSpringAnimation.

Instances

Instances details
(GObject o, IsDescendantOf SpringAnimation o) => IsSpringAnimation o Source # 
Instance details

Defined in GI.Adw.Objects.SpringAnimation

toSpringAnimation :: (MonadIO m, IsSpringAnimation o) => o -> m SpringAnimation Source #

Cast to SpringAnimation, for types for which this is known to be safe. For general casts, use castTo.

Methods

getClamp

springAnimationGetClamp Source #

Arguments

:: (HasCallStack, MonadIO m, IsSpringAnimation a) 
=> a

self: a spring animation

-> m Bool

Returns: whether self is clamped

Gets whether self should be clamped.

Since: 1.0

getEpsilon

springAnimationGetEpsilon Source #

Arguments

:: (HasCallStack, MonadIO m, IsSpringAnimation a) 
=> a

self: a spring animation

-> m Double

Returns: the epsilon value

Gets the precision of the spring.

Since: 1.0

getEstimatedDuration

springAnimationGetEstimatedDuration Source #

Arguments

:: (HasCallStack, MonadIO m, IsSpringAnimation a) 
=> a

self: a spring animation

-> m Word32

Returns: the estimated duration

Gets the estimated duration of self.

Can be [constdURATIONINFINITE] if the spring damping is set to 0.

Since: 1.0

getInitialVelocity

springAnimationGetInitialVelocity Source #

Arguments

:: (HasCallStack, MonadIO m, IsSpringAnimation a) 
=> a

self: a spring animation

-> m Double

Returns: the initial velocity

Gets the initial velocity of self.

Since: 1.0

getSpringParams

springAnimationGetSpringParams Source #

Arguments

:: (HasCallStack, MonadIO m, IsSpringAnimation a) 
=> a

self: a spring animation

-> m SpringParams

Returns: the spring parameters

Gets the physical parameters of the spring of self.

Since: 1.0

getValueFrom

springAnimationGetValueFrom Source #

Arguments

:: (HasCallStack, MonadIO m, IsSpringAnimation a) 
=> a

self: a spring animation

-> m Double

Returns: the value to animate from

Gets the value self will animate from.

Since: 1.0

getValueTo

springAnimationGetValueTo Source #

Arguments

:: (HasCallStack, MonadIO m, IsSpringAnimation a) 
=> a

self: a spring animation

-> m Double

Returns: the value to animate to

Gets the value self will animate to.

Since: 1.0

getVelocity

springAnimationGetVelocity Source #

Arguments

:: (HasCallStack, MonadIO m, IsSpringAnimation a) 
=> a

self: a spring animation

-> m Double

Returns: the current velocity

Gets the current velocity of self.

Since: 1.0

new

springAnimationNew Source #

Arguments

:: (HasCallStack, MonadIO m, IsWidget a, IsAnimationTarget b) 
=> a

widget: a widget to create animation on

-> Double

from: a value to animate from

-> Double

to: a value to animate to

-> SpringParams

springParams: physical parameters of the spring

-> b

target: a target value to animate

-> m SpringAnimation

Returns: the newly created animation

Creates a new AdwSpringAnimation on widget.

The animation will animate target from from to to with the dynamics of a spring described by springParams.

Since: 1.0

setClamp

springAnimationSetClamp Source #

Arguments

:: (HasCallStack, MonadIO m, IsSpringAnimation a) 
=> a

self: a spring animation

-> Bool

clamp: the new value

-> m () 

Sets whether self should be clamped.

If set to TRUE, the animation will abruptly end as soon as it reaches the final value, preventing overshooting.

It won't prevent overshooting [propertyspringAnimation:value-from] if a relative negative [propertyspringAnimation:initial-velocity] is set.

Since: 1.0

setEpsilon

springAnimationSetEpsilon Source #

Arguments

:: (HasCallStack, MonadIO m, IsSpringAnimation a) 
=> a

self: a spring animation

-> Double

epsilon: the new value

-> m () 

Sets the precision of the spring.

The level of precision used to determine when the animation has come to a rest, that is, when the amplitude of the oscillations becomes smaller than this value.

If the epsilon value is too small, the animation will take a long time to stop after the animated value has stopped visibly changing.

If the epsilon value is too large, the animation will end prematurely.

The default value is 0.001.

Since: 1.0

setInitialVelocity

springAnimationSetInitialVelocity Source #

Arguments

:: (HasCallStack, MonadIO m, IsSpringAnimation a) 
=> a

self: a spring animation

-> Double

velocity: the initial velocity

-> m () 

Sets the initial velocity of self.

Initial velocity affects only the animation curve, but not its duration.

Since: 1.0

setSpringParams

springAnimationSetSpringParams Source #

Arguments

:: (HasCallStack, MonadIO m, IsSpringAnimation a) 
=> a

self: a spring animation

-> SpringParams

springParams: the new spring parameters

-> m () 

Sets the physical parameters of the spring of self.

Since: 1.0

setValueFrom

springAnimationSetValueFrom Source #

Arguments

:: (HasCallStack, MonadIO m, IsSpringAnimation a) 
=> a

self: a spring animation

-> Double

value: the value to animate from

-> m () 

Sets the value self will animate from.

The animation will start at this value and end at [propertyspringAnimation:value-to].

Since: 1.0

setValueTo

springAnimationSetValueTo Source #

Arguments

:: (HasCallStack, MonadIO m, IsSpringAnimation a) 
=> a

self: a spring animation

-> Double

value: the value to animate to

-> m () 

Sets the value self will animate to.

The animation will start at [propertyspringAnimation:value-from] and end at this value.

Since: 1.0

Properties

clamp

Whether the animation should be clamped.

If set to TRUE, the animation will abruptly end as soon as it reaches the final value, preventing overshooting.

It won't prevent overshooting [propertyspringAnimation:value-from] if a relative negative [propertyspringAnimation:initial-velocity] is set.

Since: 1.0

constructSpringAnimationClamp :: (IsSpringAnimation o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “clamp” property. This is rarely needed directly, but it is used by new.

getSpringAnimationClamp :: (MonadIO m, IsSpringAnimation o) => o -> m Bool Source #

Get the value of the “clamp” property. When overloading is enabled, this is equivalent to

get springAnimation #clamp

setSpringAnimationClamp :: (MonadIO m, IsSpringAnimation o) => o -> Bool -> m () Source #

Set the value of the “clamp” property. When overloading is enabled, this is equivalent to

set springAnimation [ #clamp := value ]

epsilon

Precision of the spring.

The level of precision used to determine when the animation has come to a rest, that is, when the amplitude of the oscillations becomes smaller than this value.

If the epsilon value is too small, the animation will take a long time to stop after the animated value has stopped visibly changing.

If the epsilon value is too large, the animation will end prematurely.

The default value is 0.001.

Since: 1.0

constructSpringAnimationEpsilon :: (IsSpringAnimation o, MonadIO m) => Double -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “epsilon” property. This is rarely needed directly, but it is used by new.

getSpringAnimationEpsilon :: (MonadIO m, IsSpringAnimation o) => o -> m Double Source #

Get the value of the “epsilon” property. When overloading is enabled, this is equivalent to

get springAnimation #epsilon

setSpringAnimationEpsilon :: (MonadIO m, IsSpringAnimation o) => o -> Double -> m () Source #

Set the value of the “epsilon” property. When overloading is enabled, this is equivalent to

set springAnimation [ #epsilon := value ]

estimatedDuration

Estimated duration of the animation, in milliseconds.

Can be [constdURATIONINFINITE] if the spring damping is set to 0.

Since: 1.0

getSpringAnimationEstimatedDuration :: (MonadIO m, IsSpringAnimation o) => o -> m Word32 Source #

Get the value of the “estimated-duration” property. When overloading is enabled, this is equivalent to

get springAnimation #estimatedDuration

initialVelocity

The initial velocity to start the animation with.

Initial velocity affects only the animation curve, but not its duration.

Since: 1.0

constructSpringAnimationInitialVelocity :: (IsSpringAnimation o, MonadIO m) => Double -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “initial-velocity” property. This is rarely needed directly, but it is used by new.

getSpringAnimationInitialVelocity :: (MonadIO m, IsSpringAnimation o) => o -> m Double Source #

Get the value of the “initial-velocity” property. When overloading is enabled, this is equivalent to

get springAnimation #initialVelocity

setSpringAnimationInitialVelocity :: (MonadIO m, IsSpringAnimation o) => o -> Double -> m () Source #

Set the value of the “initial-velocity” property. When overloading is enabled, this is equivalent to

set springAnimation [ #initialVelocity := value ]

springParams

Physical parameters describing the spring.

Since: 1.0

constructSpringAnimationSpringParams :: (IsSpringAnimation o, MonadIO m) => SpringParams -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “spring-params” property. This is rarely needed directly, but it is used by new.

getSpringAnimationSpringParams :: (MonadIO m, IsSpringAnimation o) => o -> m SpringParams Source #

Get the value of the “spring-params” property. When overloading is enabled, this is equivalent to

get springAnimation #springParams

setSpringAnimationSpringParams :: (MonadIO m, IsSpringAnimation o) => o -> SpringParams -> m () Source #

Set the value of the “spring-params” property. When overloading is enabled, this is equivalent to

set springAnimation [ #springParams := value ]

valueFrom

The value to animate from.

The animation will start at this value and end at [propertyspringAnimation:value-to].

Since: 1.0

constructSpringAnimationValueFrom :: (IsSpringAnimation o, MonadIO m) => Double -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “value-from” property. This is rarely needed directly, but it is used by new.

getSpringAnimationValueFrom :: (MonadIO m, IsSpringAnimation o) => o -> m Double Source #

Get the value of the “value-from” property. When overloading is enabled, this is equivalent to

get springAnimation #valueFrom

setSpringAnimationValueFrom :: (MonadIO m, IsSpringAnimation o) => o -> Double -> m () Source #

Set the value of the “value-from” property. When overloading is enabled, this is equivalent to

set springAnimation [ #valueFrom := value ]

valueTo

The value to animate to.

The animation will start at [propertyspringAnimation:value-from] and end at this value.

Since: 1.0

constructSpringAnimationValueTo :: (IsSpringAnimation o, MonadIO m) => Double -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “value-to” property. This is rarely needed directly, but it is used by new.

getSpringAnimationValueTo :: (MonadIO m, IsSpringAnimation o) => o -> m Double Source #

Get the value of the “value-to” property. When overloading is enabled, this is equivalent to

get springAnimation #valueTo

setSpringAnimationValueTo :: (MonadIO m, IsSpringAnimation o) => o -> Double -> m () Source #

Set the value of the “value-to” property. When overloading is enabled, this is equivalent to

set springAnimation [ #valueTo := value ]

velocity

Current velocity of the animation.

Since: 1.0

getSpringAnimationVelocity :: (MonadIO m, IsSpringAnimation o) => o -> m Double Source #

Get the value of the “velocity” property. When overloading is enabled, this is equivalent to

get springAnimation #velocity