Animation

open class Animation(pointer: <Error class: unknown class><<Error class: unknown class>>)

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:

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.

Inheritors

Constructors

Link copied to clipboard
constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val adwAnimationPointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard

Whether to skip the animation when animations are globally disabled.

Link copied to clipboard

The animation state.

Link copied to clipboard

The target to animate.

Link copied to clipboard
open val value: Double

The current value of the animation.

Link copied to clipboard
open val widget: <Error class: unknown class>

The animation widget.

Functions

Link copied to clipboard
fun connectDone(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: () -> Unit): <Error class: unknown class>

This signal is emitted when the animation has been completed, either on its own or via calling method@Animation.skip.

Link copied to clipboard

Gets whether @self should be skipped when animations are globally disabled.

Link copied to clipboard

Gets the current value of @self.

Link copied to clipboard

Gets the target @self animates.

Link copied to clipboard
open fun getValue(): Double

Gets the current value of @self.

Link copied to clipboard
open fun getWidget(): <Error class: unknown class>

Gets the widget @self was created for.

Link copied to clipboard
open fun pause()

Pauses a playing animation for @self.

Link copied to clipboard
open fun play()

Starts the animation for @self.

Link copied to clipboard
open fun reset()

Resets the animation for @self.

Link copied to clipboard
open fun resume()

Resumes a paused animation for @self.

Link copied to clipboard

Sets whether to skip @self when animations are globally disabled.

Link copied to clipboard
open fun setTarget(target: AnimationTarget)

Sets the target @self animates to @target.

Link copied to clipboard
open fun skip()

Skips the animation for @self.