forked from llimllib/chrome-control
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAnimation.py
157 lines (116 loc) · 4.96 KB
/
Animation.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
from enum import Enum
from typing import Any, List
from base import ChromeCommand
import DOM
class Animation:
"""Animation instance."""
def __init__(self, id: str, name: str, pausedState: bool, playState: str, playbackRate: float, startTime: float, currentTime: float, source: "AnimationEffect", type: str, cssId: str=None):
# <code>Animation</code>'s id.
self.id = id
# <code>Animation</code>'s name.
self.name = name
# <code>Animation</code>'s internal paused state.
self.pausedState = pausedState
# <code>Animation</code>'s play state.
self.playState = playState
# <code>Animation</code>'s playback rate.
self.playbackRate = playbackRate
# <code>Animation</code>'s start time.
self.startTime = startTime
# <code>Animation</code>'s current time.
self.currentTime = currentTime
# <code>Animation</code>'s source animation node.
self.source = source
# Animation type of <code>Animation</code>.
self.type = type
# A unique ID for <code>Animation</code> representing the sources that triggered this CSS animation/transition.
self.cssId = cssId
class AnimationEffect:
"""AnimationEffect instance"""
def __init__(self, delay: float, endDelay: float, iterationStart: float, iterations: float, duration: float, direction: str, fill: str, backendNodeId: "DOM.BackendNodeId", easing: str, keyframesRule: "KeyframesRule"=None):
# <code>AnimationEffect</code>'s delay.
self.delay = delay
# <code>AnimationEffect</code>'s end delay.
self.endDelay = endDelay
# <code>AnimationEffect</code>'s iteration start.
self.iterationStart = iterationStart
# <code>AnimationEffect</code>'s iterations.
self.iterations = iterations
# <code>AnimationEffect</code>'s iteration duration.
self.duration = duration
# <code>AnimationEffect</code>'s playback direction.
self.direction = direction
# <code>AnimationEffect</code>'s fill mode.
self.fill = fill
# <code>AnimationEffect</code>'s target node.
self.backendNodeId = backendNodeId
# <code>AnimationEffect</code>'s timing function.
self.easing = easing
# <code>AnimationEffect</code>'s keyframes.
self.keyframesRule = keyframesRule
class KeyframesRule:
"""Keyframes Rule"""
def __init__(self, keyframes: List, name: str=None):
# List of animation keyframes.
self.keyframes = keyframes
# CSS keyframed animation's name.
self.name = name
class KeyframeStyle:
"""Keyframe Style"""
def __init__(self, offset: str, easing: str):
# Keyframe's time offset.
self.offset = offset
# <code>AnimationEffect</code>'s timing function.
self.easing = easing
class enable(ChromeCommand):
"""Enables animation domain notifications."""
def __init__(self): pass
class disable(ChromeCommand):
"""Disables animation domain notifications."""
def __init__(self): pass
class getPlaybackRate(ChromeCommand):
"""Gets the playback rate of the document timeline."""
def __init__(self): pass
class setPlaybackRate(ChromeCommand):
"""Sets the playback rate of the document timeline."""
def __init__(self, playbackRate: float):
# Playback rate for animations on page
self.playbackRate = playbackRate
class getCurrentTime(ChromeCommand):
"""Returns the current time of the an animation."""
def __init__(self, id: str):
# Id of animation.
self.id = id
class setPaused(ChromeCommand):
"""Sets the paused state of a set of animations."""
def __init__(self, animations: List, paused: bool):
# Animations to set the pause state of.
self.animations = animations
# Paused state to set to.
self.paused = paused
class setTiming(ChromeCommand):
"""Sets the timing of an animation node."""
def __init__(self, animationId: str, duration: float, delay: float):
# Animation id.
self.animationId = animationId
# Duration of the animation.
self.duration = duration
# Delay of the animation.
self.delay = delay
class seekAnimations(ChromeCommand):
"""Seek a set of animations to a particular time within each animation."""
def __init__(self, animations: List, currentTime: float):
# List of animation ids to seek.
self.animations = animations
# Set the current time of each animation.
self.currentTime = currentTime
class releaseAnimations(ChromeCommand):
"""Releases a set of animations to no longer be manipulated."""
def __init__(self, animations: List):
# List of animation ids to seek.
self.animations = animations
class resolveAnimation(ChromeCommand):
"""Gets the remote object of the Animation."""
def __init__(self, animationId: str):
# Animation id.
self.animationId = animationId