Skip to main content

cdp_protocol/
animation.rs

1// Auto-generated from Chrome at version 146.0.7680.165 domain: Animation
2#![allow(dead_code)]
3use super::dom;
4use super::runtime;
5#[allow(unused_imports)]
6use super::types::*;
7#[allow(unused_imports)]
8use derive_builder::Builder;
9#[allow(unused_imports)]
10use serde::{Deserialize, Serialize};
11#[allow(unused_imports)]
12use serde_json::Value as Json;
13#[allow(deprecated)]
14#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
15pub enum AnimationType {
16    #[serde(rename = "CSSTransition")]
17    CssTransition,
18    #[serde(rename = "CSSAnimation")]
19    CssAnimation,
20    #[serde(rename = "WebAnimation")]
21    WebAnimation,
22}
23#[allow(deprecated)]
24#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
25#[builder(setter(into, strip_option))]
26#[serde(rename_all = "camelCase")]
27#[doc = "Animation instance."]
28pub struct Animation {
29    #[serde(default)]
30    #[doc = "`Animation`'s id."]
31    pub id: String,
32    #[serde(default)]
33    #[doc = "`Animation`'s name."]
34    pub name: String,
35    #[serde(default)]
36    #[doc = "`Animation`'s internal paused state."]
37    pub paused_state: bool,
38    #[serde(default)]
39    #[doc = "`Animation`'s play state."]
40    pub play_state: String,
41    #[serde(default)]
42    #[doc = "`Animation`'s playback rate."]
43    pub playback_rate: JsFloat,
44    #[serde(default)]
45    #[doc = "`Animation`'s start time.\n Milliseconds for time based animations and\n percentage \\[0 - 100\\] for scroll driven animations\n (i.e. when viewOrScrollTimeline exists)."]
46    pub start_time: JsFloat,
47    #[serde(default)]
48    #[doc = "`Animation`'s current time."]
49    pub current_time: JsFloat,
50    #[doc = "Animation type of `Animation`."]
51    pub r#type: AnimationType,
52    #[builder(default)]
53    #[serde(skip_serializing_if = "Option::is_none")]
54    #[doc = "`Animation`'s source animation node."]
55    pub source: Option<AnimationEffect>,
56    #[builder(default)]
57    #[serde(skip_serializing_if = "Option::is_none")]
58    #[serde(default)]
59    #[doc = "A unique ID for `Animation` representing the sources that triggered this CSS\n animation/transition."]
60    pub css_id: Option<String>,
61    #[builder(default)]
62    #[serde(skip_serializing_if = "Option::is_none")]
63    #[doc = "View or scroll timeline"]
64    pub view_or_scroll_timeline: Option<ViewOrScrollTimeline>,
65}
66#[allow(deprecated)]
67#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
68#[builder(setter(into, strip_option))]
69#[serde(rename_all = "camelCase")]
70#[doc = "Timeline instance"]
71pub struct ViewOrScrollTimeline {
72    #[builder(default)]
73    #[serde(skip_serializing_if = "Option::is_none")]
74    #[doc = "Scroll container node"]
75    pub source_node_id: Option<dom::BackendNodeId>,
76    #[builder(default)]
77    #[serde(skip_serializing_if = "Option::is_none")]
78    #[serde(default)]
79    #[doc = "Represents the starting scroll position of the timeline\n as a length offset in pixels from scroll origin."]
80    pub start_offset: Option<JsFloat>,
81    #[builder(default)]
82    #[serde(skip_serializing_if = "Option::is_none")]
83    #[serde(default)]
84    #[doc = "Represents the ending scroll position of the timeline\n as a length offset in pixels from scroll origin."]
85    pub end_offset: Option<JsFloat>,
86    #[builder(default)]
87    #[serde(skip_serializing_if = "Option::is_none")]
88    #[doc = "The element whose principal box's visibility in the\n scrollport defined the progress of the timeline.\n Does not exist for animations with ScrollTimeline"]
89    pub subject_node_id: Option<dom::BackendNodeId>,
90    #[doc = "Orientation of the scroll"]
91    pub axis: dom::ScrollOrientation,
92}
93#[allow(deprecated)]
94#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
95#[builder(setter(into, strip_option))]
96#[serde(rename_all = "camelCase")]
97#[doc = "AnimationEffect instance"]
98pub struct AnimationEffect {
99    #[serde(default)]
100    #[doc = "`AnimationEffect`'s delay."]
101    pub delay: JsFloat,
102    #[serde(default)]
103    #[doc = "`AnimationEffect`'s end delay."]
104    pub end_delay: JsFloat,
105    #[serde(default)]
106    #[doc = "`AnimationEffect`'s iteration start."]
107    pub iteration_start: JsFloat,
108    #[builder(default)]
109    #[serde(skip_serializing_if = "Option::is_none")]
110    #[serde(default)]
111    #[doc = "`AnimationEffect`'s iterations. Omitted if the value is infinite."]
112    pub iterations: Option<JsFloat>,
113    #[serde(default)]
114    #[doc = "`AnimationEffect`'s iteration duration.\n Milliseconds for time based animations and\n percentage \\[0 - 100\\] for scroll driven animations\n (i.e. when viewOrScrollTimeline exists)."]
115    pub duration: JsFloat,
116    #[serde(default)]
117    #[doc = "`AnimationEffect`'s playback direction."]
118    pub direction: String,
119    #[serde(default)]
120    #[doc = "`AnimationEffect`'s fill mode."]
121    pub fill: String,
122    #[builder(default)]
123    #[serde(skip_serializing_if = "Option::is_none")]
124    #[doc = "`AnimationEffect`'s target node."]
125    pub backend_node_id: Option<dom::BackendNodeId>,
126    #[builder(default)]
127    #[serde(skip_serializing_if = "Option::is_none")]
128    #[doc = "`AnimationEffect`'s keyframes."]
129    pub keyframes_rule: Option<KeyframesRule>,
130    #[serde(default)]
131    #[doc = "`AnimationEffect`'s timing function."]
132    pub easing: String,
133}
134#[allow(deprecated)]
135#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
136#[builder(setter(into, strip_option))]
137#[serde(rename_all = "camelCase")]
138#[doc = "Keyframes Rule"]
139pub struct KeyframesRule {
140    #[builder(default)]
141    #[serde(skip_serializing_if = "Option::is_none")]
142    #[serde(default)]
143    #[doc = "CSS keyframed animation's name."]
144    pub name: Option<String>,
145    #[doc = "List of animation keyframes."]
146    pub keyframes: Vec<KeyframeStyle>,
147}
148#[allow(deprecated)]
149#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
150#[builder(setter(into, strip_option))]
151#[serde(rename_all = "camelCase")]
152#[doc = "Keyframe Style"]
153pub struct KeyframeStyle {
154    #[serde(default)]
155    #[doc = "Keyframe's time offset."]
156    pub offset: String,
157    #[serde(default)]
158    #[doc = "`AnimationEffect`'s timing function."]
159    pub easing: String,
160}
161#[allow(deprecated)]
162#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
163pub struct Disable(pub Option<Json>);
164#[allow(deprecated)]
165#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
166pub struct Enable(pub Option<Json>);
167#[allow(deprecated)]
168#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
169#[builder(setter(into, strip_option))]
170#[serde(rename_all = "camelCase")]
171#[doc = "Returns the current time of the an animation."]
172pub struct GetCurrentTime {
173    #[serde(default)]
174    #[doc = "Id of animation."]
175    pub id: String,
176}
177#[allow(deprecated)]
178#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
179pub struct GetPlaybackRate(pub Option<Json>);
180#[allow(deprecated)]
181#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
182#[builder(setter(into, strip_option))]
183#[serde(rename_all = "camelCase")]
184#[doc = "Releases a set of animations to no longer be manipulated."]
185pub struct ReleaseAnimations {
186    #[serde(default)]
187    #[doc = "List of animation ids to seek."]
188    pub animations: Vec<String>,
189}
190#[allow(deprecated)]
191#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
192#[builder(setter(into, strip_option))]
193#[serde(rename_all = "camelCase")]
194#[doc = "Gets the remote object of the Animation."]
195pub struct ResolveAnimation {
196    #[serde(default)]
197    #[doc = "Animation id."]
198    pub animation_id: String,
199}
200#[allow(deprecated)]
201#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
202#[builder(setter(into, strip_option))]
203#[serde(rename_all = "camelCase")]
204#[doc = "Seek a set of animations to a particular time within each animation."]
205pub struct SeekAnimations {
206    #[serde(default)]
207    #[doc = "List of animation ids to seek."]
208    pub animations: Vec<String>,
209    #[serde(default)]
210    #[doc = "Set the current time of each animation."]
211    pub current_time: JsFloat,
212}
213#[allow(deprecated)]
214#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
215#[builder(setter(into, strip_option))]
216#[serde(rename_all = "camelCase")]
217#[doc = "Sets the paused state of a set of animations."]
218pub struct SetPaused {
219    #[serde(default)]
220    #[doc = "Animations to set the pause state of."]
221    pub animations: Vec<String>,
222    #[serde(default)]
223    #[doc = "Paused state to set to."]
224    pub paused: bool,
225}
226#[allow(deprecated)]
227#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
228#[builder(setter(into, strip_option))]
229#[serde(rename_all = "camelCase")]
230#[doc = "Sets the playback rate of the document timeline."]
231pub struct SetPlaybackRate {
232    #[serde(default)]
233    #[doc = "Playback rate for animations on page"]
234    pub playback_rate: JsFloat,
235}
236#[allow(deprecated)]
237#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
238#[builder(setter(into, strip_option))]
239#[serde(rename_all = "camelCase")]
240#[doc = "Sets the timing of an animation node."]
241pub struct SetTiming {
242    #[serde(default)]
243    #[doc = "Animation id."]
244    pub animation_id: String,
245    #[serde(default)]
246    #[doc = "Duration of the animation."]
247    pub duration: JsFloat,
248    #[serde(default)]
249    #[doc = "Delay of the animation."]
250    pub delay: JsFloat,
251}
252#[allow(deprecated)]
253#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
254#[doc = "Disables animation domain notifications."]
255pub struct DisableReturnObject(pub Option<Json>);
256#[allow(deprecated)]
257#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
258#[doc = "Enables animation domain notifications."]
259pub struct EnableReturnObject(pub Option<Json>);
260#[allow(deprecated)]
261#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
262#[serde(rename_all = "camelCase")]
263#[doc = "Returns the current time of the an animation."]
264pub struct GetCurrentTimeReturnObject {
265    #[serde(default)]
266    #[doc = "Current time of the page."]
267    pub current_time: JsFloat,
268}
269#[allow(deprecated)]
270#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
271#[serde(rename_all = "camelCase")]
272#[doc = "Gets the playback rate of the document timeline."]
273pub struct GetPlaybackRateReturnObject {
274    #[serde(default)]
275    #[doc = "Playback rate for animations on page."]
276    pub playback_rate: JsFloat,
277}
278#[allow(deprecated)]
279#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
280#[doc = "Releases a set of animations to no longer be manipulated."]
281pub struct ReleaseAnimationsReturnObject(pub Option<Json>);
282#[allow(deprecated)]
283#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
284#[serde(rename_all = "camelCase")]
285#[doc = "Gets the remote object of the Animation."]
286pub struct ResolveAnimationReturnObject {
287    #[doc = "Corresponding remote object."]
288    pub remote_object: runtime::RemoteObject,
289}
290#[allow(deprecated)]
291#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
292#[doc = "Seek a set of animations to a particular time within each animation."]
293pub struct SeekAnimationsReturnObject(pub Option<Json>);
294#[allow(deprecated)]
295#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
296#[doc = "Sets the paused state of a set of animations."]
297pub struct SetPausedReturnObject(pub Option<Json>);
298#[allow(deprecated)]
299#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
300#[doc = "Sets the playback rate of the document timeline."]
301pub struct SetPlaybackRateReturnObject(pub Option<Json>);
302#[allow(deprecated)]
303#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
304#[doc = "Sets the timing of an animation node."]
305pub struct SetTimingReturnObject(pub Option<Json>);
306#[allow(deprecated)]
307impl Method for Disable {
308    const NAME: &'static str = "Animation.disable";
309    type ReturnObject = DisableReturnObject;
310}
311#[allow(deprecated)]
312impl Method for Enable {
313    const NAME: &'static str = "Animation.enable";
314    type ReturnObject = EnableReturnObject;
315}
316#[allow(deprecated)]
317impl Method for GetCurrentTime {
318    const NAME: &'static str = "Animation.getCurrentTime";
319    type ReturnObject = GetCurrentTimeReturnObject;
320}
321#[allow(deprecated)]
322impl Method for GetPlaybackRate {
323    const NAME: &'static str = "Animation.getPlaybackRate";
324    type ReturnObject = GetPlaybackRateReturnObject;
325}
326#[allow(deprecated)]
327impl Method for ReleaseAnimations {
328    const NAME: &'static str = "Animation.releaseAnimations";
329    type ReturnObject = ReleaseAnimationsReturnObject;
330}
331#[allow(deprecated)]
332impl Method for ResolveAnimation {
333    const NAME: &'static str = "Animation.resolveAnimation";
334    type ReturnObject = ResolveAnimationReturnObject;
335}
336#[allow(deprecated)]
337impl Method for SeekAnimations {
338    const NAME: &'static str = "Animation.seekAnimations";
339    type ReturnObject = SeekAnimationsReturnObject;
340}
341#[allow(deprecated)]
342impl Method for SetPaused {
343    const NAME: &'static str = "Animation.setPaused";
344    type ReturnObject = SetPausedReturnObject;
345}
346#[allow(deprecated)]
347impl Method for SetPlaybackRate {
348    const NAME: &'static str = "Animation.setPlaybackRate";
349    type ReturnObject = SetPlaybackRateReturnObject;
350}
351#[allow(deprecated)]
352impl Method for SetTiming {
353    const NAME: &'static str = "Animation.setTiming";
354    type ReturnObject = SetTimingReturnObject;
355}
356#[allow(dead_code)]
357pub mod events {
358    #[allow(unused_imports)]
359    use super::super::types::*;
360    #[allow(unused_imports)]
361    use derive_builder::Builder;
362    #[allow(unused_imports)]
363    use serde::{Deserialize, Serialize};
364    #[allow(unused_imports)]
365    use serde_json::Value as Json;
366    #[allow(deprecated)]
367    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
368    pub struct AnimationCanceledEvent {
369        pub params: AnimationCanceledEventParams,
370    }
371    #[allow(deprecated)]
372    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
373    #[serde(rename_all = "camelCase")]
374    pub struct AnimationCanceledEventParams {
375        #[serde(default)]
376        #[doc = "Id of the animation that was cancelled."]
377        pub id: String,
378    }
379    #[allow(deprecated)]
380    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
381    pub struct AnimationCreatedEvent {
382        pub params: AnimationCreatedEventParams,
383    }
384    #[allow(deprecated)]
385    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
386    #[serde(rename_all = "camelCase")]
387    pub struct AnimationCreatedEventParams {
388        #[serde(default)]
389        #[doc = "Id of the animation that was created."]
390        pub id: String,
391    }
392    #[allow(deprecated)]
393    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
394    pub struct AnimationStartedEvent {
395        pub params: AnimationStartedEventParams,
396    }
397    #[allow(deprecated)]
398    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
399    #[serde(rename_all = "camelCase")]
400    pub struct AnimationStartedEventParams {
401        #[doc = "Animation that was started."]
402        pub animation: super::Animation,
403    }
404    #[allow(deprecated)]
405    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
406    pub struct AnimationUpdatedEvent {
407        pub params: AnimationUpdatedEventParams,
408    }
409    #[allow(deprecated)]
410    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
411    #[serde(rename_all = "camelCase")]
412    pub struct AnimationUpdatedEventParams {
413        #[doc = "Animation that was updated."]
414        pub animation: super::Animation,
415    }
416}