Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
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
- newtype SpringParams = SpringParams (ManagedPtr SpringParams)
- springParamsGetDamping :: (HasCallStack, MonadIO m) => SpringParams -> m Double
- springParamsGetDampingRatio :: (HasCallStack, MonadIO m) => SpringParams -> m Double
- springParamsGetMass :: (HasCallStack, MonadIO m) => SpringParams -> m Double
- springParamsGetStiffness :: (HasCallStack, MonadIO m) => SpringParams -> m Double
- springParamsNew :: (HasCallStack, MonadIO m) => Double -> Double -> Double -> m SpringParams
- springParamsNewFull :: (HasCallStack, MonadIO m) => Double -> Double -> Double -> m SpringParams
- springParamsRef :: (HasCallStack, MonadIO m) => SpringParams -> m SpringParams
- springParamsUnref :: (HasCallStack, MonadIO m) => SpringParams -> m ()
Exported types
newtype SpringParams Source #
Memory-managed wrapper type.
SpringParams (ManagedPtr SpringParams) |
Instances
Eq SpringParams Source # | |
Defined in GI.Adw.Structs.SpringParams (==) :: SpringParams -> SpringParams -> Bool # (/=) :: SpringParams -> SpringParams -> Bool # | |
GBoxed SpringParams Source # | |
Defined in GI.Adw.Structs.SpringParams | |
ManagedPtrNewtype SpringParams Source # | |
Defined in GI.Adw.Structs.SpringParams toManagedPtr :: SpringParams -> ManagedPtr SpringParams | |
TypedObject SpringParams Source # | |
Defined in GI.Adw.Structs.SpringParams | |
HasParentTypes SpringParams Source # | |
Defined in GI.Adw.Structs.SpringParams | |
IsGValue (Maybe SpringParams) Source # | Convert |
Defined in GI.Adw.Structs.SpringParams gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe SpringParams -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe SpringParams) | |
type ParentTypes SpringParams Source # | |
Defined in GI.Adw.Structs.SpringParams |
Methods
Click to display all available methods, including inherited ones
getDamping
springParamsGetDamping Source #
:: (HasCallStack, MonadIO m) | |
=> SpringParams |
|
-> m Double | Returns: the damping |
Gets the damping of self
.
Since: 1.0
getDampingRatio
springParamsGetDampingRatio Source #
:: (HasCallStack, MonadIO m) | |
=> SpringParams |
|
-> m Double | Returns: the damping ratio |
Gets the damping ratio of self
.
Since: 1.0
getMass
:: (HasCallStack, MonadIO m) | |
=> SpringParams |
|
-> m Double | Returns: the mass |
Gets the mass of self
.
Since: 1.0
getStiffness
springParamsGetStiffness Source #
:: (HasCallStack, MonadIO m) | |
=> SpringParams |
|
-> m Double | Returns: the stiffness |
Gets the stiffness of self
.
Since: 1.0
new
:: (HasCallStack, MonadIO m) | |
=> Double |
|
-> Double |
|
-> Double |
|
-> 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.
- ctor
springParams
.new_full - allows to pass a raw damping value instead.
Since: 1.0
newFull
:: (HasCallStack, MonadIO m) | |
=> Double |
|
-> Double |
|
-> Double |
|
-> 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
:: (HasCallStack, MonadIO m) | |
=> SpringParams |
|
-> m SpringParams | Returns: |
Increases the reference count of self
.
Since: 1.0
unref
:: (HasCallStack, MonadIO m) | |
=> SpringParams |
|
-> m () |
Decreases the reference count of self
.
If the last reference is dropped, the structure is freed.
Since: 1.0