adw.animation
Module for [Animation] class
Types 3
A base class for animations.
adw.animation.Animation 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: adw.timed_animation.TimedAnimation and adw.spring_animation.SpringAnimation.
adw.animation.Animation will automatically skip the animation if adw.animation.Animation.widget is unmapped, or if gtk.settings.Settings.gtkEnableAnimations is FALSE.
The adw.animation.Animation.done signal can be used to perform an action after the animation ends, for example hiding a widget after animating its gtk.widget.Widget.opacity to 0.
adw.animation.Animation 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:
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 adw.animation.Animation object can be reused.
AnimationGidBuilder builder() static nothrowGet builder for [adw.animation.Animation] Returns: New builder objectbool followEnableAnimationsSetting() @property nothrowGet `followEnableAnimationsSetting` property. Returns: Whether to skip the animation when animations are globally disabled.void followEnableAnimationsSetting(bool propval) @property nothrowSet `followEnableAnimationsSetting` property. Params: propval = Whether to skip the animation when animations are globally disabled.adw.types.AnimationState state() @property nothrowGet `state` property. Returns: The animation state.adw.animation_target.AnimationTarget target() @property nothrowGet `target` property. Returns: The target to animate.void target(adw.animation_target.AnimationTarget propval) @property nothrowSet `target` property. Params: propval = The target to animate.bool getFollowEnableAnimationsSetting() nothrowGets whether self should be skipped when animations are globally disabled. Returns: whether to follow the global settingadw.animation_target.AnimationTarget getTarget() nothrowGets the target self animates. Returns: the animation targetvoid setFollowEnableAnimationsSetting(bool setting) nothrowSets whether to skip self when animations are globally disabled.void setTarget(adw.animation_target.AnimationTarget target) nothrowSets the target self animates to target.gulong connectDone(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : adw.animation.Animation)))
&& Parameters!T.length < 2) nothrowConnect to `Done` signal.Fluent builder implementation template for adw.animation.Animation
T followEnableAnimationsSetting(bool propval) nothrowSet `followEnableAnimationsSetting` property. Params: propval = Whether to skip the animation when animations are globally disabled.T target(adw.animation_target.AnimationTarget propval) nothrowSet `target` property. Params: propval = The target to animate. Returns: Builder instance for fluent chainingT widget(gtk.widget.Widget propval) nothrowSet `widget` property. Params: propval = The animation widget.Fluent builder for adw.animation.Animation