Package ch.bailu.gtk.adw
Klasse Animation
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.gobject.Object
ch.bailu.gtk.type.PropertyHolder
ch.bailu.gtk.adw.Animation
- Alle implementierten Schnittstellen:
PointerInterface
- Bekannte direkte Unterklassen:
SpringAnimation
,TimedAnimation
A base class for animations.
`AdwAnimation` represents an animation on a widget. It has a target that
provides a value to animate, and a state indicating whether the
animation hasn't been started yet, is playing, paused or finished.
Currently there are two concrete animation types:
[class@TimedAnimation] and [class@SpringAnimation].
`AdwAnimation` will automatically skip the animation if
[property@Animation:widget] is unmapped, or if
[property@Gtk.Settings:gtk-enable-animations] is `FALSE`.
The [signal@Animation::done] signal can be used to perform an action after
the animation ends, for example hiding a widget after animating its
[property@Gtk.Widget:opacity] to 0.
`AdwAnimation` will be kept alive while the animation is playing. As such,
it's safe to create an animation, start it and immediately unref it:
A fire-and-forget animation:
```c
static void
animation_cb (double value,
MyObject *self)
{
// Do something with @value
}
static void
my_object_animate (MyObject *self)
{
AdwAnimationTarget *target =
adw_callback_animation_target_new ((AdwAnimationTargetFunc) animation_cb,
self, NULL);
g_autoptr (AdwAnimation) animation =
adw_timed_animation_new (widget, 0, 1, 250, target);
adw_animation_play (animation);
}
```
If there's a chance the previous animation for the same target hasn't yet
finished, the previous animation should be stopped first, or the existing
`AdwAnimation` object can be reused.
`AdwAnimation` represents an animation on a widget. It has a target that
provides a value to animate, and a state indicating whether the
animation hasn't been started yet, is playing, paused or finished.
Currently there are two concrete animation types:
[class@TimedAnimation] and [class@SpringAnimation].
`AdwAnimation` will automatically skip the animation if
[property@Animation:widget] is unmapped, or if
[property@Gtk.Settings:gtk-enable-animations] is `FALSE`.
The [signal@Animation::done] signal can be used to perform an action after
the animation ends, for example hiding a widget after animating its
[property@Gtk.Widget:opacity] to 0.
`AdwAnimation` will be kept alive while the animation is playing. As such,
it's safe to create an animation, start it and immediately unref it:
A fire-and-forget animation:
```c
static void
animation_cb (double value,
MyObject *self)
{
// Do something with @value
}
static void
my_object_animate (MyObject *self)
{
AdwAnimationTarget *target =
adw_callback_animation_target_new ((AdwAnimationTargetFunc) animation_cb,
self, NULL);
g_autoptr (AdwAnimation) animation =
adw_timed_animation_new (widget, 0, 1, 250, target);
adw_animation_play (animation);
}
```
If there's a chance the previous animation for the same target hasn't yet
finished, the previous animation should be stopped first, or the existing
`AdwAnimation` object can be reused.
https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.Animation.html
-
Verschachtelte Klassen - Übersicht
Verschachtelte KlassenVon Klasse geerbte verschachtelte Klassen/Schnittstellen ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDestroyNotify, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify
-
Feldübersicht
FelderVon Klasse geerbte Felder ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic ClassHandler
boolean
Gets whether @self should be skipped when animations are globally disabled.static int
static long
static TypeSystem.TypeSize
int
getState()
Gets the current value of @self.Gets the target @self animates.static long
static TypeSystem.TypeSize
double
getValue()
Gets the current value of @self.Gets the widget @self was created for.onDone
(Animation.OnDone signal) Connect to signal "done".void
pause()
Pauses a playing animation for @self.void
play()
Starts the animation for @self.void
reset()
Resets the animation for @self.void
resume()
Resumes a paused animation for @self.void
setFollowEnableAnimationsSetting
(boolean setting) Sets whether to skip @self when animations are globally disabled.void
setTarget
(AnimationTarget target) Sets the target @self animates to @target.void
skip()
Skips the animation for @self.Von Klasse geerbte Methoden ch.bailu.gtk.type.PropertyHolder
getBooleanProperty, getIntProperty, getObjectProperty, getStringProperty, getStrProperty, setBooleanProperty, setIntProperty, setObjectProperty, setStringProperty, setStrProperty
Von Klasse geerbte Methoden ch.bailu.gtk.gobject.Object
addToggleRef, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, disconnect, disconnect, dupData, dupData, dupQdata, forceFloating, freezeNotify, get, get, getData, getData, getProperty, getProperty, getQdata, interfaceFindProperty, interfaceInstallProperty, isFloating, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, replaceData, replaceData, replaceQdata, runDispose, set, set, setData, setData, setDataFull, setDataFull, setProperty, setProperty, setQdata, setQdataFull, stealData, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref
Von Klasse geerbte Methoden ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Von Klasse geerbte Methoden ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Von Klasse geerbte Methoden java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Von Schnittstelle geerbte Methoden ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Felddetails
-
SIGNAL_ON_DONE
- Siehe auch:
-
-
Konstruktordetails
-
Animation
-
-
Methodendetails
-
getClassHandler
-
getFollowEnableAnimationsSetting
public boolean getFollowEnableAnimationsSetting()Gets whether @self should be skipped when animations are globally disabled.- Gibt zurück:
- whether to follow the global setting
-
getState
public int getState()Gets the current value of @self.
The state indicates whether @self is currently playing, paused, finished or
hasn't been started yet.- Gibt zurück:
- the animation value
-
getTarget
Gets the target @self animates.- Gibt zurück:
- the animation target
-
getValue
public double getValue()Gets the current value of @self.- Gibt zurück:
- the current value
-
getWidget
Gets the widget @self was created for.
It provides the frame clock for the animation. It's not strictly necessary
for this widget to be same as the one being animated.
The widget must be mapped in order for the animation to work. If it's not
mapped, or if it gets unmapped during an ongoing animation, the animation
will be automatically skipped.- Gibt zurück:
- the animation widget
-
pause
public void pause()Pauses a playing animation for @self.
Does nothing if the current state of @self isn't `ADW_ANIMATION_PLAYING`.
Sets [property@Animation:state] to `ADW_ANIMATION_PAUSED`. -
play
public void play()Starts the animation for @self.
If the animation is playing, paused or has been completed, restarts it from
the beginning. This allows to easily play an animation regardless of whether
it's already playing or not.
Sets [property@Animation:state] to `ADW_ANIMATION_PLAYING`.
The animation will be automatically skipped if [property@Animation:widget] is
unmapped, or if [property@Gtk.Settings:gtk-enable-animations] is `FALSE`.
As such, it's not guaranteed that the animation will actually run. For
example, when using [func@GLib.idle_add] and starting an animation
immediately afterwards, it's entirely possible that the idle callback will
run after the animation has already finished, and not while it's playing. -
reset
public void reset()Resets the animation for @self.
Sets [property@Animation:state] to `ADW_ANIMATION_IDLE`. -
resume
public void resume()Resumes a paused animation for @self.
This function must only be used if the animation has been paused with
[method@Animation.pause].
Sets [property@Animation:state] to `ADW_ANIMATION_PLAYING`. -
setFollowEnableAnimationsSetting
public void setFollowEnableAnimationsSetting(boolean setting) Sets whether to skip @self when animations are globally disabled.
The default behavior is to skip the animation. Set to `FALSE` to disable this
behavior.
This can be useful for cases where animation is essential, like spinners, or
in demo applications. Most other animations should keep it enabled.
See [property@Gtk.Settings:gtk-enable-animations].- Parameter:
setting
- whether to follow the global setting
-
setTarget
Sets the target @self animates to @target.- Parameter:
target
- an animation target
-
skip
public void skip()Skips the animation for @self.
If the animation hasn't been started yet, is playing, or is paused, instantly
skips the animation to the end and causes [signal@Animation::done] to be
emitted.
Sets [property@Animation:state] to `ADW_ANIMATION_FINISHED`. -
onDone
Connect to signal "done".
SeeAnimation.OnDone.onDone()
for signal description.
FieldSIGNAL_ON_DONE
contains original signal name and can be used as resource reference.- Parameter:
signal
- callback function (lambda).- Gibt zurück:
SignalHandler
. Can be used to disconnect signal and to release callback function.
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-