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.

Methods
GType _gType() @property
Animation self()Returns `this`, for use in `with` statements.
AnimationGidBuilder builder()Get builder for [adw.animation.Animation] Returns: New builder object
bool 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.types.AnimationState state() @propertyGet `state` property. Returns: The animation state.
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.
double value() @propertyGet `value` property. Returns: The current value of the animation.
gtk.widget.Widget widget() @propertyGet `widget` property. Returns: The animation widget.
bool getFollowEnableAnimationsSetting()Gets whether self should be skipped when animations are globally disabled. Returns: whether to follow the global setting
adw.types.AnimationState getState()Gets the current value of self.
adw.animation_target.AnimationTarget getTarget()Gets the target self animates. Returns: the animation target
double getValue()Gets the current value of self. Returns: the current value
gtk.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.
Constructors
this(void * ptr, Flag!"Take" take)
Methods
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 chaining
T widget(gtk.widget.Widget propval)Set `widget` property. Params: propval = The animation widget.

Fluent builder for [adw.animation.Animation]

Methods