libadwaita::prelude

Trait AnimationExt

source
pub trait AnimationExt: IsA<Animation> + 'static {
Show 17 methods // Provided methods fn follows_enable_animations_setting(&self) -> bool { ... } fn state(&self) -> AnimationState { ... } fn target(&self) -> AnimationTarget { ... } fn value(&self) -> f64 { ... } fn widget(&self) -> Widget { ... } fn pause(&self) { ... } fn play(&self) { ... } fn reset(&self) { ... } fn resume(&self) { ... } fn set_follow_enable_animations_setting(&self, setting: bool) { ... } fn set_target(&self, target: &impl IsA<AnimationTarget>) { ... } fn skip(&self) { ... } fn connect_done<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { ... } fn connect_follow_enable_animations_setting_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_state_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_target_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_value_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... }
}
Expand description

Trait containing all Animation methods.

§Implementors

Animation, SpringAnimation, TimedAnimation

Provided Methods§

source

fn follows_enable_animations_setting(&self) -> bool

Available on crate feature v1_3 only.

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

§Returns

whether to follow the global setting

source

fn state(&self) -> AnimationState

Gets the current value of @self.

The state indicates whether @self is currently playing, paused, finished or hasn’t been started yet.

§Returns

the animation value

source

fn target(&self) -> AnimationTarget

Gets the target @self animates.

§Returns

the animation target

source

fn value(&self) -> f64

Gets the current value of @self.

§Returns

the current value

source

fn widget(&self) -> Widget

Gets the widget @self was created for.

It provides the frame clock for the animation. It’s not strictly necessary for this widget to be same as the one being animated.

The widget must be mapped in order for the animation to work. If it’s not mapped, or if it gets unmapped during an ongoing animation, the animation will be automatically skipped.

§Returns

the animation widget

source

fn pause(&self)

Pauses a playing animation for @self.

Does nothing if the current state of @self isn’t ADW_ANIMATION_PLAYING.

Sets state to ADW_ANIMATION_PAUSED.

source

fn play(&self)

Starts the animation for @self.

If the animation is playing, paused or has been completed, restarts it from the beginning. This allows to easily play an animation regardless of whether it’s already playing or not.

Sets state to ADW_ANIMATION_PLAYING.

The animation will be automatically skipped if widget is unmapped, or if gtk-enable-animations is FALSE.

As such, it’s not guaranteed that the animation will actually run. For example, when using idle_add() and starting an animation immediately afterwards, it’s entirely possible that the idle callback will run after the animation has already finished, and not while it’s playing.

source

fn reset(&self)

Resets the animation for @self.

Sets state to ADW_ANIMATION_IDLE.

source

fn resume(&self)

Resumes a paused animation for @self.

This function must only be used if the animation has been paused with pause().

Sets state to ADW_ANIMATION_PLAYING.

source

fn set_follow_enable_animations_setting(&self, setting: bool)

Available on crate feature v1_3 only.

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

The default behavior is to skip the animation. Set to FALSE to disable this behavior.

This can be useful for cases where animation is essential, like spinners, or in demo applications. Most other animations should keep it enabled.

See gtk-enable-animations.

§setting

whether to follow the global setting

source

fn set_target(&self, target: &impl IsA<AnimationTarget>)

Sets the target @self animates to @target.

§target

an animation target

source

fn skip(&self)

Skips the animation for @self.

If the animation hasn’t been started yet, is playing, or is paused, instantly skips the animation to the end and causes done to be emitted.

Sets state to ADW_ANIMATION_FINISHED.

source

fn connect_done<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId

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

source

fn connect_follow_enable_animations_setting_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Available on crate feature v1_3 only.
source

fn connect_state_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId

source

fn connect_target_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId

source

fn connect_value_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§