|
| 1 | +# DO NOT EDIT THIS FILE! |
| 2 | +# |
| 3 | +# This code is generated off of PyCDP modules. If you need to make |
| 4 | +# changes, edit the generator and regenerate all of the modules. |
| 5 | + |
| 6 | +from __future__ import annotations |
| 7 | +import typing |
| 8 | + |
| 9 | +from ..context import get_connection_context, get_session_context |
| 10 | + |
| 11 | +import cdp.animation |
| 12 | +from cdp.animation import ( |
| 13 | + Animation, |
| 14 | + AnimationCanceled, |
| 15 | + AnimationCreated, |
| 16 | + AnimationEffect, |
| 17 | + AnimationStarted, |
| 18 | + KeyframeStyle, |
| 19 | + KeyframesRule |
| 20 | +) |
| 21 | + |
| 22 | + |
| 23 | +async def disable() -> None: |
| 24 | + ''' |
| 25 | + Disables animation domain notifications. |
| 26 | + ''' |
| 27 | + session = get_session_context('animation.disable') |
| 28 | + return await session.execute(cdp.animation.disable()) |
| 29 | + |
| 30 | + |
| 31 | +async def enable() -> None: |
| 32 | + ''' |
| 33 | + Enables animation domain notifications. |
| 34 | + ''' |
| 35 | + session = get_session_context('animation.enable') |
| 36 | + return await session.execute(cdp.animation.enable()) |
| 37 | + |
| 38 | + |
| 39 | +async def get_current_time( |
| 40 | + id: str |
| 41 | + ) -> float: |
| 42 | + ''' |
| 43 | + Returns the current time of the an animation. |
| 44 | +
|
| 45 | + :param id: Id of animation. |
| 46 | + :returns: Current time of the page. |
| 47 | + ''' |
| 48 | + session = get_session_context('animation.get_current_time') |
| 49 | + return await session.execute(cdp.animation.get_current_time(id)) |
| 50 | + |
| 51 | + |
| 52 | +async def get_playback_rate() -> float: |
| 53 | + ''' |
| 54 | + Gets the playback rate of the document timeline. |
| 55 | +
|
| 56 | + :returns: Playback rate for animations on page. |
| 57 | + ''' |
| 58 | + session = get_session_context('animation.get_playback_rate') |
| 59 | + return await session.execute(cdp.animation.get_playback_rate()) |
| 60 | + |
| 61 | + |
| 62 | +async def release_animations( |
| 63 | + animations: typing.List[str] |
| 64 | + ) -> None: |
| 65 | + ''' |
| 66 | + Releases a set of animations to no longer be manipulated. |
| 67 | +
|
| 68 | + :param animations: List of animation ids to seek. |
| 69 | + ''' |
| 70 | + session = get_session_context('animation.release_animations') |
| 71 | + return await session.execute(cdp.animation.release_animations(animations)) |
| 72 | + |
| 73 | + |
| 74 | +async def resolve_animation( |
| 75 | + animation_id: str |
| 76 | + ) -> runtime.RemoteObject: |
| 77 | + ''' |
| 78 | + Gets the remote object of the Animation. |
| 79 | +
|
| 80 | + :param animation_id: Animation id. |
| 81 | + :returns: Corresponding remote object. |
| 82 | + ''' |
| 83 | + session = get_session_context('animation.resolve_animation') |
| 84 | + return await session.execute(cdp.animation.resolve_animation(animation_id)) |
| 85 | + |
| 86 | + |
| 87 | +async def seek_animations( |
| 88 | + animations: typing.List[str], |
| 89 | + current_time: float |
| 90 | + ) -> None: |
| 91 | + ''' |
| 92 | + Seek a set of animations to a particular time within each animation. |
| 93 | +
|
| 94 | + :param animations: List of animation ids to seek. |
| 95 | + :param current_time: Set the current time of each animation. |
| 96 | + ''' |
| 97 | + session = get_session_context('animation.seek_animations') |
| 98 | + return await session.execute(cdp.animation.seek_animations(animations, current_time)) |
| 99 | + |
| 100 | + |
| 101 | +async def set_paused( |
| 102 | + animations: typing.List[str], |
| 103 | + paused: bool |
| 104 | + ) -> None: |
| 105 | + ''' |
| 106 | + Sets the paused state of a set of animations. |
| 107 | +
|
| 108 | + :param animations: Animations to set the pause state of. |
| 109 | + :param paused: Paused state to set to. |
| 110 | + ''' |
| 111 | + session = get_session_context('animation.set_paused') |
| 112 | + return await session.execute(cdp.animation.set_paused(animations, paused)) |
| 113 | + |
| 114 | + |
| 115 | +async def set_playback_rate( |
| 116 | + playback_rate: float |
| 117 | + ) -> None: |
| 118 | + ''' |
| 119 | + Sets the playback rate of the document timeline. |
| 120 | +
|
| 121 | + :param playback_rate: Playback rate for animations on page |
| 122 | + ''' |
| 123 | + session = get_session_context('animation.set_playback_rate') |
| 124 | + return await session.execute(cdp.animation.set_playback_rate(playback_rate)) |
| 125 | + |
| 126 | + |
| 127 | +async def set_timing( |
| 128 | + animation_id: str, |
| 129 | + duration: float, |
| 130 | + delay: float |
| 131 | + ) -> None: |
| 132 | + ''' |
| 133 | + Sets the timing of an animation node. |
| 134 | +
|
| 135 | + :param animation_id: Animation id. |
| 136 | + :param duration: Duration of the animation. |
| 137 | + :param delay: Delay of the animation. |
| 138 | + ''' |
| 139 | + session = get_session_context('animation.set_timing') |
| 140 | + return await session.execute(cdp.animation.set_timing(animation_id, duration, delay)) |
0 commit comments