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: class@TimedAnimation and class@SpringAnimation.
[adw.animation.Animation] 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 [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()Get builder for [adw.animation.Animation] Returns: New builder objectbool followEnableAnimationsSetting() @propertyGet `followEnableAnimationsSetting` property. Returns: Whether to skip the animation when animations are globally disabled.void followEnableAnimationsSetting(bool propval) @propertySet `followEnableAnimationsSetting` property. Params: propval = Whether to skip the animation when animations are globally disabled.adw.animation_target.AnimationTarget target() @propertyGet `target` property. Returns: The target to animate.void target(adw.animation_target.AnimationTarget propval) @propertySet `target` property. Params: propval = The target to animate.bool getFollowEnableAnimationsSetting()Gets whether self should be skipped when animations are globally disabled. Returns: whether to follow the global settingadw.types.AnimationState getState()Gets the current value of self.adw.animation_target.AnimationTarget getTarget()Gets the target self animates. Returns: the animation targetdouble getValue()Gets the current value of self. Returns: the current valuegtk.widget.Widget getWidget()Gets the widget self was created for.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(bool setting)Sets whether to skip self when animations are globally disabled.void setTarget(adw.animation_target.AnimationTarget target)Sets the target self animates to target.void skip()Skips the animation for self.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)Connect to `Done` signal.T followEnableAnimationsSetting(bool propval)Set `followEnableAnimationsSetting` property. Params: propval = Whether to skip the animation when animations are globally disabled.T target(adw.animation_target.AnimationTarget propval)Set `target` property. Params: propval = The target to animate. Returns: Builder instance for fluent chainingT widget(gtk.widget.Widget propval)Set `widget` property. Params: propval = The animation widget.