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.Structs.SpringParams

Description

Physical parameters of a spring for [classspringAnimation].

Any spring can be described by three parameters: mass, stiffness and damping.

An undamped spring will produce an oscillatory motion which will go on forever.

The frequency and amplitude of the oscillations will be determined by the stiffness (how "strong" the spring is) and its mass (how much "inertia" it has).

If damping is larger than 0, the amplitude of that oscillating motion will exponientally decrease over time. If that damping is strong enough that the spring can't complete a full oscillation, it's called an overdamped spring.

If we the spring can oscillate, it's called an underdamped spring.

The value between these two behaviors is called critical damping; a critically damped spring will comes to rest in the minimum possible time without producing oscillations.

The damping can be replaced by damping ratio, which produces the following springs:

  • 0: an undamped spring.
  • Between 0 and 1: an underdamped spring.
  • 1: a critically damped spring.
  • Larger than 1: an overdamped spring.

As such

Since: 1.0

Synopsis

Exported types

newtype SpringParams Source #

Memory-managed wrapper type.

Constructors

SpringParams (ManagedPtr SpringParams) 

Instances

Instances details
Eq SpringParams Source # 
Instance details

Defined in GI.Adw.Structs.SpringParams

GBoxed SpringParams Source # 
Instance details

Defined in GI.Adw.Structs.SpringParams

ManagedPtrNewtype SpringParams Source # 
Instance details

Defined in GI.Adw.Structs.SpringParams

Methods

toManagedPtr :: SpringParams -> ManagedPtr SpringParams

TypedObject SpringParams Source # 
Instance details

Defined in GI.Adw.Structs.SpringParams

Methods

glibType :: IO GType

HasParentTypes SpringParams Source # 
Instance details

Defined in GI.Adw.Structs.SpringParams

IsGValue (Maybe SpringParams) Source #

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

Instance details

Defined in GI.Adw.Structs.SpringParams

Methods

gvalueGType_ :: IO GType

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

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

type ParentTypes SpringParams Source # 
Instance details

Defined in GI.Adw.Structs.SpringParams

type ParentTypes SpringParams = '[] :: [Type]

Methods

Click to display all available methods, including inherited ones

Expand

Methods

ref, unref.

Getters

getDamping, getDampingRatio, getMass, getStiffness.

Setters

None.

getDamping

springParamsGetDamping Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> SpringParams

self: spring params

-> m Double

Returns: the damping

Gets the damping of self.

Since: 1.0

getDampingRatio

springParamsGetDampingRatio Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> SpringParams

self: spring params

-> m Double

Returns: the damping ratio

Gets the damping ratio of self.

Since: 1.0

getMass

springParamsGetMass Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> SpringParams

self: spring params

-> m Double

Returns: the mass

Gets the mass of self.

Since: 1.0

getStiffness

springParamsGetStiffness Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> SpringParams

self: spring params

-> m Double

Returns: the stiffness

Gets the stiffness of self.

Since: 1.0

new

springParamsNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Double

dampingRatio: the damping ratio of the spring

-> Double

mass: the mass of the spring

-> Double

stiffness: the stiffness of the spring

-> m SpringParams

Returns: the newly created spring parameters

Creates a new AdwSpringParams from mass, stiffness and dampingRatio.

The damping value is calculated from dampingRatio and the other two parameters.

  • If dampingRatio is 0, the spring will not be damped and will oscillate endlessly.
  • If dampingRatio is between 0 and 1, the spring is underdamped and will always overshoot.
  • If dampingRatio is 1, the spring is critically damped and will reach its resting position the quickest way possible.
  • If dampingRatio is larger than 1, the spring is overdamped and will reach its resting position faster than it can complete an oscillation.
ctorspringParams.new_full
allows to pass a raw damping value instead.

Since: 1.0

newFull

springParamsNewFull Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Double

damping: the damping of the spring

-> Double

mass: the mass of the spring

-> Double

stiffness: the stiffness of the spring

-> m SpringParams

Returns: the newly created spring parameters

Creates a new AdwSpringParams from mass, stiffness and damping.

See [ctorspringParams.new] for a simplified constructor using damping ratio instead of damping.

Since: 1.0

ref

springParamsRef Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> SpringParams

self: spring params

-> m SpringParams

Returns: self

Increases the reference count of self.

Since: 1.0

unref

springParamsUnref Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> SpringParams

self: spring params

-> m () 

Decreases the reference count of self.

If the last reference is dropped, the structure is freed.

Since: 1.0