Animation

This CDP domain is experimental.

Types

Generally, you do not need to instantiate CDP types yourself. Instead, the API creates objects for you as return values from commands, and then you can use those objects as arguments to other commands.

class cdp.animation.Animation(id_, name, paused_state, play_state, playback_rate, start_time, current_time, type_, source=None, css_id=None)

Animation instance.

css_id = None

A unique ID for Animation representing the sources that triggered this CSS animation/transition.

current_time = None

Animation’s current time.

id_ = None

Animation’s id.

name = None

Animation’s name.

paused_state = None

Animation’s internal paused state.

play_state = None

Animation’s play state.

playback_rate = None

Animation’s playback rate.

source = None

Animation’s source animation node.

start_time = None

Animation’s start time.

type_ = None

Animation type of Animation.

class cdp.animation.AnimationEffect(delay, end_delay, iteration_start, iterations, duration, direction, fill, easing, backend_node_id=None, keyframes_rule=None)

AnimationEffect instance

backend_node_id = None

AnimationEffect’s target node.

delay = None

AnimationEffect’s delay.

direction = None

AnimationEffect’s playback direction.

duration = None

AnimationEffect’s iteration duration.

easing = None

AnimationEffect’s timing function.

end_delay = None

AnimationEffect’s end delay.

fill = None

AnimationEffect’s fill mode.

iteration_start = None

AnimationEffect’s iteration start.

iterations = None

AnimationEffect’s iterations.

keyframes_rule = None

AnimationEffect’s keyframes.

class cdp.animation.KeyframesRule(keyframes, name=None)

Keyframes Rule

keyframes = None

List of animation keyframes.

name = None

CSS keyframed animation’s name.

class cdp.animation.KeyframeStyle(offset, easing)

Keyframe Style

easing = None

AnimationEffect’s timing function.

offset = None

Keyframe’s time offset.

Commands

Each command is a generator function. The return type Generator[x, y, z] indicates that the generator yields arguments of type x, it must be resumed with an argument of type y, and it returns type z. In this library, types x and y are the same for all commands, and z is the return type you should pay attention to. For more information, see Getting Started: Commands.

cdp.animation.disable()

Disables animation domain notifications.

Return type:Generator[Dict[str, Any], Dict[str, Any], None]
cdp.animation.enable()

Enables animation domain notifications.

Return type:Generator[Dict[str, Any], Dict[str, Any], None]
cdp.animation.get_current_time(id_)

Returns the current time of the an animation.

Parameters:id – Id of animation.
Return type:Generator[Dict[str, Any], Dict[str, Any], float]
Returns:Current time of the page.
cdp.animation.get_playback_rate()

Gets the playback rate of the document timeline.

Return type:Generator[Dict[str, Any], Dict[str, Any], float]
Returns:Playback rate for animations on page.
cdp.animation.release_animations(animations)

Releases a set of animations to no longer be manipulated.

Parameters:animations (List[str]) – List of animation ids to seek.
Return type:Generator[Dict[str, Any], Dict[str, Any], None]
cdp.animation.resolve_animation(animation_id)

Gets the remote object of the Animation.

Parameters:animation_id (str) – Animation id.
Return type:Generator[Dict[str, Any], Dict[str, Any], RemoteObject]
Returns:Corresponding remote object.
cdp.animation.seek_animations(animations, current_time)

Seek a set of animations to a particular time within each animation.

Parameters:
  • animations (List[str]) – List of animation ids to seek.
  • current_time (float) – Set the current time of each animation.
Return type:

Generator[Dict[str, Any], Dict[str, Any], None]

cdp.animation.set_paused(animations, paused)

Sets the paused state of a set of animations.

Parameters:
  • animations (List[str]) – Animations to set the pause state of.
  • paused (bool) – Paused state to set to.
Return type:

Generator[Dict[str, Any], Dict[str, Any], None]

cdp.animation.set_playback_rate(playback_rate)

Sets the playback rate of the document timeline.

Parameters:playback_rate (float) – Playback rate for animations on page
Return type:Generator[Dict[str, Any], Dict[str, Any], None]
cdp.animation.set_timing(animation_id, duration, delay)

Sets the timing of an animation node.

Parameters:
  • animation_id (str) – Animation id.
  • duration (float) – Duration of the animation.
  • delay (float) – Delay of the animation.
Return type:

Generator[Dict[str, Any], Dict[str, Any], None]

Events

Generally, you do not need to instantiate CDP events yourself. Instead, the API creates events for you and then you use the event’s attributes.

class cdp.animation.AnimationCanceled(id_)

Event for when an animation has been cancelled.

id_ = None

Id of the animation that was cancelled.

class cdp.animation.AnimationCreated(id_)

Event for each animation that has been created.

id_ = None

Id of the animation that was created.

class cdp.animation.AnimationStarted(animation)

Event for animation that has been started.

animation = None

Animation that was started.