Package ch.bailu.gtk.adw
Class SpringParams
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.type.Record
ch.bailu.gtk.adw.SpringParams
- All Implemented Interfaces:
PointerInterface
Physical parameters of a spring for [class@SpringAnimation].
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
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
https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/struct.SpringParams.html
-
Field Summary
-
Constructor Summary
ConstructorDescriptionSpringParams
(double damping_ratio, double mass, double stiffness) Creates a new `AdwSpringParams` from @mass, @stiffness and @damping_ratio.SpringParams
(PointerContainer pointer) -
Method Summary
Modifier and TypeMethodDescriptionstatic ClassHandler
double
Gets the damping of @self.double
Gets the damping ratio of @self.static int
double
getMass()
Gets the mass of @self.static long
static TypeSystem.TypeSize
double
Gets the stiffness of @self.static long
static TypeSystem.TypeSize
static SpringParams
newFullSpringParams
(double damping, double mass, double stiffness) Creates a new `AdwSpringParams` from @mass, @stiffness and @damping.ref()
Increases the reference count of @self.void
unref()
Decreases the reference count of @self.Methods inherited from class ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Methods inherited from class ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Constructor Details
-
SpringParams
-
SpringParams
public SpringParams(double damping_ratio, double mass, double stiffness) Creates a new `AdwSpringParams` from @mass, @stiffness and @damping_ratio.
The damping value is calculated from @damping_ratio and the other two
parameters.
* If @damping_ratio is 0, the spring will not be damped and will oscillate
endlessly.
* If @damping_ratio is between 0 and 1, the spring is underdamped and will
always overshoot.
* If @damping_ratio is 1, the spring is critically damped and will reach its
resting position the quickest way possible.
* If @damping_ratio 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.- Parameters:
damping_ratio
- the damping ratio of the springmass
- the mass of the springstiffness
- the stiffness of the spring
-
-
Method Details
-
getClassHandler
-
newFullSpringParams
Creates a new `AdwSpringParams` from @mass, @stiffness and @damping.
See [ctor@SpringParams.new] for a simplified constructor using damping ratio
instead of @damping.- Parameters:
damping
- the damping of the springmass
- the mass of the springstiffness
- the stiffness of the spring- Returns:
- the newly created spring parameters
-
getDamping
public double getDamping()Gets the damping of @self.- Returns:
- the damping
-
getDampingRatio
public double getDampingRatio()Gets the damping ratio of @self.- Returns:
- the damping ratio
-
getMass
public double getMass()Gets the mass of @self.- Returns:
- the mass
-
getStiffness
public double getStiffness()Gets the stiffness of @self.- Returns:
- the stiffness
-
ref
Increases the reference count of @self.- Returns:
- @self
-
unref
public void unref()Decreases the reference count of @self.
If the last reference is dropped, the structure is freed. -
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-