-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathAnimation.php
More file actions
157 lines (142 loc) · 2.88 KB
/
Animation.php
File metadata and controls
157 lines (142 loc) · 2.88 KB
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
155
156
157
<?php
namespace ChromeDevtoolsProtocol\Model\Animation;
/**
* Animation instance.
*
* @generated This file has been auto-generated, do not edit.
*
* @author Jakub Kulhan <jakub.kulhan@gmail.com>
*/
final class Animation implements \JsonSerializable
{
/**
* `Animation`'s id.
*
* @var string
*/
public $id;
/**
* `Animation`'s name.
*
* @var string
*/
public $name;
/**
* `Animation`'s internal paused state.
*
* @var bool
*/
public $pausedState;
/**
* `Animation`'s play state.
*
* @var string
*/
public $playState;
/**
* `Animation`'s playback rate.
*
* @var int|float
*/
public $playbackRate;
/**
* `Animation`'s start time.
*
* @var int|float
*/
public $startTime;
/**
* `Animation`'s current time.
*
* @var int|float
*/
public $currentTime;
/**
* Animation type of `Animation`.
*
* @var string
*/
public $type;
/**
* `Animation`'s source animation node.
*
* @var AnimationEffect|null
*/
public $source;
/**
* A unique ID for `Animation` representing the sources that triggered this CSS animation/transition.
*
* @var string|null
*/
public $cssId;
public static function fromJson($data)
{
$instance = new static();
if (isset($data->id)) {
$instance->id = (string)$data->id;
}
if (isset($data->name)) {
$instance->name = (string)$data->name;
}
if (isset($data->pausedState)) {
$instance->pausedState = (bool)$data->pausedState;
}
if (isset($data->playState)) {
$instance->playState = (string)$data->playState;
}
if (isset($data->playbackRate)) {
$instance->playbackRate = $data->playbackRate;
}
if (isset($data->startTime)) {
$instance->startTime = $data->startTime;
}
if (isset($data->currentTime)) {
$instance->currentTime = $data->currentTime;
}
if (isset($data->type)) {
$instance->type = (string)$data->type;
}
if (isset($data->source)) {
$instance->source = AnimationEffect::fromJson($data->source);
}
if (isset($data->cssId)) {
$instance->cssId = (string)$data->cssId;
}
return $instance;
}
public function jsonSerialize(): mixed
{
$data = new \stdClass();
if ($this->id !== null) {
$data->id = $this->id;
}
if ($this->name !== null) {
$data->name = $this->name;
}
if ($this->pausedState !== null) {
$data->pausedState = $this->pausedState;
}
if ($this->playState !== null) {
$data->playState = $this->playState;
}
if ($this->playbackRate !== null) {
$data->playbackRate = $this->playbackRate;
}
if ($this->startTime !== null) {
$data->startTime = $this->startTime;
}
if ($this->currentTime !== null) {
$data->currentTime = $this->currentTime;
}
if ($this->type !== null) {
$data->type = $this->type;
}
if ($this->source !== null) {
$data->source = $this->source->jsonSerialize();
}
if ($this->cssId !== null) {
$data->cssId = $this->cssId;
}
return $data;
}
}