:right-sidebar: True SpringAnimation =================================================================== .. currentmodule:: gi.repository.Adw .. class:: SpringAnimation(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.Adw.Animation`, :class:`~gi.repository.GObject.Object` :Constructors: :: SpringAnimation(**properties) new(widget:Gtk.Widget, from_:float, to:float, spring_params:Adw.SpringParams, target:Adw.AnimationTarget) -> Adw.Animation Constructors ------------ .. rst-class:: interim-class .. class:: SpringAnimation :no-index: .. classmethod:: new(widget: ~gi.repository.Gtk.Widget, from_: float, to: float, spring_params: ~gi.repository.Adw.SpringParams, target: ~gi.repository.Adw.AnimationTarget) -> ~gi.repository.Adw.Animation Creates a new ``AdwSpringAnimation`` on ``widget``. The animation will animate ``target`` from ``from`` to ``to`` with the dynamics of a spring described by ``spring_params``. :param widget: a widget to create animation on :param from_: :param to: a value to animate to :param spring_params: physical parameters of the spring :param target: a target value to animate Methods ------- .. rst-class:: interim-class .. class:: SpringAnimation :no-index: .. method:: calculate_value(time: int) -> float Calculates the value ``self`` will have at ``time``. The time starts at 0 and ends at :obj:`~gi.repository.Adw.SpringAnimation.props.estimated_duration`. See also :obj:`~gi.repository.SpringAnimation.calculate_velocity`. .. versionadded:: 1.3 :param time: elapsed time, in milliseconds .. method:: calculate_velocity(time: int) -> float Calculates the velocity ``self`` will have at ``time``. The time starts at 0 and ends at :obj:`~gi.repository.Adw.SpringAnimation.props.estimated_duration`. See also :obj:`~gi.repository.SpringAnimation.calculate_value`. .. versionadded:: 1.3 :param time: elapsed time, in milliseconds .. method:: get_clamp() -> bool Gets whether ``self`` should be clamped. .. method:: get_epsilon() -> float Gets the precision of the spring. .. method:: get_estimated_duration() -> int Gets the estimated duration of ``self``, in milliseconds. Can be :obj:`~gi.repository.Adw.DURATION_INFINITE` if the spring damping is set to 0. .. method:: get_initial_velocity() -> float Gets the initial velocity of ``self``. .. method:: get_spring_params() -> ~gi.repository.Adw.SpringParams Gets the physical parameters of the spring of ``self``. .. method:: get_value_from() -> float Gets the value ``self`` will animate from. .. method:: get_value_to() -> float Gets the value ``self`` will animate to. .. method:: get_velocity() -> float Gets the current velocity of ``self``. .. method:: set_clamp(clamp: bool) -> None Sets whether ``self`` should be clamped. If set to ``TRUE``, the animation will abruptly end as soon as it reaches the final value, preventing overshooting. It won't prevent overshooting :obj:`~gi.repository.Adw.SpringAnimation.props.value_from` if a relative negative :obj:`~gi.repository.Adw.SpringAnimation.props.initial_velocity` is set. :param clamp: the new value .. method:: set_epsilon(epsilon: float) -> None Sets the precision of the spring. The level of precision used to determine when the animation has come to a rest, that is, when the amplitude of the oscillations becomes smaller than this value. If the epsilon value is too small, the animation will take a long time to stop after the animated value has stopped visibly changing. If the epsilon value is too large, the animation will end prematurely. The default value is 0.001. :param epsilon: the new value .. method:: set_initial_velocity(velocity: float) -> None Sets the initial velocity of ``self``. Initial velocity affects only the animation curve, but not its duration. :param velocity: the initial velocity .. method:: set_spring_params(spring_params: ~gi.repository.Adw.SpringParams) -> None Sets the physical parameters of the spring of ``self``. :param spring_params: the new spring parameters .. method:: set_value_from(value: float) -> None Sets the value ``self`` will animate from. The animation will start at this value and end at :obj:`~gi.repository.Adw.SpringAnimation.props.value_to`. :param value: the value to animate from .. method:: set_value_to(value: float) -> None Sets the value ``self`` will animate to. The animation will start at :obj:`~gi.repository.Adw.SpringAnimation.props.value_from` and end at this value. :param value: the value to animate to Properties ---------- .. rst-class:: interim-class .. class:: SpringAnimation :no-index: .. attribute:: props.clamp :type: bool Whether the animation should be clamped. If set to ``TRUE``, the animation will abruptly end as soon as it reaches the final value, preventing overshooting. It won't prevent overshooting :obj:`~gi.repository.Adw.SpringAnimation.props.value_from` if a relative negative :obj:`~gi.repository.Adw.SpringAnimation.props.initial_velocity` is set. .. attribute:: props.epsilon :type: float Precision of the spring. The level of precision used to determine when the animation has come to a rest, that is, when the amplitude of the oscillations becomes smaller than this value. If the epsilon value is too small, the animation will take a long time to stop after the animated value has stopped visibly changing. If the epsilon value is too large, the animation will end prematurely. The default value is 0.001. .. attribute:: props.estimated_duration :type: int Estimated duration of the animation, in milliseconds. Can be :obj:`~gi.repository.Adw.DURATION_INFINITE` if the spring damping is set to 0. .. attribute:: props.initial_velocity :type: float The initial velocity to start the animation with. Initial velocity affects only the animation curve, but not its duration. .. attribute:: props.spring_params :type: ~gi.repository.Adw.SpringParams Physical parameters describing the spring. .. attribute:: props.value_from :type: float The value to animate from. The animation will start at this value and end at :obj:`~gi.repository.Adw.SpringAnimation.props.value_to`. .. attribute:: props.value_to :type: float The value to animate to. The animation will start at :obj:`~gi.repository.Adw.SpringAnimation.props.value_from` and end at this value. .. attribute:: props.velocity :type: float Current velocity of the animation.