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.

Methods
GType _getGType() static nothrow
GType _gType() @property nothrow
Animation self() nothrowReturns `this`, for use in `with` statements.
AnimationGidBuilder builder() static nothrowGet builder for [adw.animation.Animation] Returns: New builder object
bool 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.
double value() @property nothrowGet `value` property. Returns: The current value of the animation.
gtk.widget.Widget widget() @property nothrowGet `widget` property. Returns: The animation widget.
bool getFollowEnableAnimationsSetting() nothrowGets whether self should be skipped when animations are globally disabled. Returns: whether to follow the global setting
adw.types.AnimationState getState() nothrowGets the current value of self.
adw.animation_target.AnimationTarget getTarget() nothrowGets the target self animates. Returns: the animation target
double getValue() nothrowGets the current value of self. Returns: the current value
gtk.widget.Widget getWidget() nothrowGets the widget self was created for.
void pause() nothrowPauses a playing animation for self.
void play() nothrowStarts the animation for self.
void reset() nothrowResets the animation for self.
void resume() nothrowResumes a paused animation for self.
void 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.
void skip() nothrowSkips 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) nothrowConnect to `Done` signal.
Constructors
this(void * ptr, Flag!"Take" take)

Fluent builder implementation template for adw.animation.Animation

Methods
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 chaining
T widget(gtk.widget.Widget propval) nothrowSet `widget` property. Params: propval = The animation widget.

Fluent builder for adw.animation.Animation

Methods
Animation build() nothrowCreate object from builder. Returns: New object