-
Notifications
You must be signed in to change notification settings - Fork 0
/
Animation.cljs
446 lines (305 loc) · 13.2 KB
/
Animation.cljs
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
(ns web.animation.Animation
"The Animation interface of the Web Animations API represents
single animation player and provides playback controls and a
for an animation node or source."
(:refer-clojure :exclude [reverse]))
(def constructor
"Constructor.
The Animation() constructor of the Web Animations API returns a new Animation object instance.
effect Optional
The target effect, as an object based on the `AnimationEffectReadOnly` interface, to assign to the animation. Although in the future other effects such as SequenceEffects or GroupEffects might be possible, the only kind of effect currently available is `web.animation.KeyframeEffect`. This can be null (which is the default) to indicate that there should be no effect applied.
timeline Optional
Specifies the timeline with which to associate the animation, as an object of a type based on the `web.animation.AnimationTimeline` interface. Currently the only timeline type available is `web.animation.DocumentTimeline`, but in the future there my be timelines associated with gestures or scrolling, for example. The default value is `Document.timeline`, but this can be set to null as well.
See also: `https://developer.mozilla.org/en-US/docs/Web/API/Animation/Animation`"
js/Animation)
(defn cancel
"Method.
The Web Animations API's cancel() method of the `web.animation.Animation`
clears all `web.animation.KeyframeEffect`s caused by this animation
aborts its playback.
`Animation.cancel();`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/Animation/cancel`"
[this ]
(-> this (.cancel)))
(defn finish
"Method.
The finish() method of the Web Animations API's `web.animation.Animation`
sets the current playback time to the end of the animation corresponding
the current playback direction.
`Animation.finish();`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/Animation/finish`"
[this ]
(-> this (.finish)))
(defn pause
"Method.
The pause() method of the Web Animations API's `web.animation.Animation`
suspends playback of the animation.
`animation.pause();`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/Animation/pause`"
[this ]
(-> this (.pause)))
(defn play
"Method.
The play() method of the Web Animations API's `web.animation.Animation`
starts or resumes playing of an animation. If the animation is
calling play() restarts the animation, playing it from the beginning.
`animation.play();`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/Animation/play`"
[this ]
(-> this (.play)))
(defn reverse
"Method.
The Animation.reverse() method of the `web.animation.Animation`
reverses the playback direction, meaning the animation ends at
beginning. If called on an unplayed animation, the whole animation
played backwards. If called on a paused animation, the animation
continue in reverse.
`animation.reverse();`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/Animation/reverse`"
[this ]
(-> this (.reverse)))
(defn update-playback-rate
"Method.
The updatePlaybackRate() method of the Web Animations API's `web.animation.Animation`
sets the speed of an animation after first synchronizing its
position.
`Animation.updatePlaybackRate(2);`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/Animation/updatePlaybackRate`"
[this & args]
(-> this .-updatePlaybackRate (.apply this (clj->js args))))
(defn current-time
"Property.
The Animation.currentTime property of the Web Animations API
and sets the current time value of the animation in milliseconds,
running or paused.
`var currentTime = Animation.currentTime;
Animation.currentTime = newTime;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/Animation/currentTime`"
[this]
(-> this (.-currentTime)))
(defn set-current-time!
"Property.
The Animation.currentTime property of the Web Animations API
and sets the current time value of the animation in milliseconds,
running or paused.
`var currentTime = Animation.currentTime;
Animation.currentTime = newTime;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/Animation/currentTime`"
[this val]
(aset this "currentTime" val))
(defn effect
"Property.
The Animation.effect property of the Web Animations API gets
sets the target effect of an animation. The target effect may
either an effect object of a type based on `AnimationEffectReadOnly`,
as `web.animation.KeyframeEffect`, or null.
`var effect = Animation.effect;
Animation.effect = AnimationEffectReadOnly`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/Animation/effect`"
[this]
(-> this (.-effect)))
(defn set-effect!
"Property.
The Animation.effect property of the Web Animations API gets
sets the target effect of an animation. The target effect may
either an effect object of a type based on `AnimationEffectReadOnly`,
as `web.animation.KeyframeEffect`, or null.
`var effect = Animation.effect;
Animation.effect = AnimationEffectReadOnly`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/Animation/effect`"
[this val]
(aset this "effect" val))
(defn finished
"Property.
The Animation.finished read-only property of the Web Animations
returns a `js.Promise` which resolves once the animation has
playing.
`var animationsPromise = Animation.finished;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/Animation/finished`"
[this]
(-> this (.-finished)))
(defn set-finished!
"Property.
The Animation.finished read-only property of the Web Animations
returns a `js.Promise` which resolves once the animation has
playing.
`var animationsPromise = Animation.finished;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/Animation/finished`"
[this val]
(aset this "finished" val))
(defn id
"Property.
The Animation.id property of the Web Animations API returns or
a string used to identify the animation.
`var animationsId = Animation.id;
Animation.id = newIdString;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/Animation/id`"
[this]
(-> this (.-id)))
(defn set-id!
"Property.
The Animation.id property of the Web Animations API returns or
a string used to identify the animation.
`var animationsId = Animation.id;
Animation.id = newIdString;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/Animation/id`"
[this val]
(aset this "id" val))
(defn pending
"Property.
The read-only Animation.pending property of the Web Animations
indicates whether the animation is currently waiting for an asynchronous
such as initiating playback or pausing a running animation.
`var pending = Animation.pending;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/Animation/pending`"
[this]
(-> this (.-pending)))
(defn set-pending!
"Property.
The read-only Animation.pending property of the Web Animations
indicates whether the animation is currently waiting for an asynchronous
such as initiating playback or pausing a running animation.
`var pending = Animation.pending;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/Animation/pending`"
[this val]
(aset this "pending" val))
(defn play-state
"Property.
The Animation.playState property of the Web Animations API returns
sets an enumerated value describing the playback state of an
`var currentPlayState = Animation.playState;
Animation.playState = newState;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/Animation/playState`"
[this]
(-> this (.-playState)))
(defn set-play-state!
"Property.
The Animation.playState property of the Web Animations API returns
sets an enumerated value describing the playback state of an
`var currentPlayState = Animation.playState;
Animation.playState = newState;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/Animation/playState`"
[this val]
(aset this "playState" val))
(defn playback-rate
"Property.
The Animation.playbackRate property of the Web Animations API
or sets the playback rate of the animation.
`var currentPlaybackRate = Animation.playbackRate;
Animation.playbackRate = newRate;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/Animation/playbackRate`"
[this]
(-> this (.-playbackRate)))
(defn set-playback-rate!
"Property.
The Animation.playbackRate property of the Web Animations API
or sets the playback rate of the animation.
`var currentPlaybackRate = Animation.playbackRate;
Animation.playbackRate = newRate;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/Animation/playbackRate`"
[this val]
(aset this "playbackRate" val))
(defn ready
"Property.
The read-only Animation.ready property of the Web Animations
returns a `js.Promise` which resolves when the animation is ready
play. A new promise is created every time the animation enters
\\\"pending\\\" play state as well as when the animation is canceled,
in both of those scenarios, the animation is ready to be started
`var readyPromise = Animation.ready;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/Animation/ready`"
[this]
(-> this (.-ready)))
(defn set-ready!
"Property.
The read-only Animation.ready property of the Web Animations
returns a `js.Promise` which resolves when the animation is ready
play. A new promise is created every time the animation enters
\\\"pending\\\" play state as well as when the animation is canceled,
in both of those scenarios, the animation is ready to be started
`var readyPromise = Animation.ready;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/Animation/ready`"
[this val]
(aset this "ready" val))
(defn start-time
"Property.
The Animation.startTime property of the `web.animation.Animation`
is a double-precision floating-point value which indicates the
time when an animation's playback should begin.
`var animationStartedWhen = Animation.startTime;
Animation.startTime = newStartTime;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/Animation/startTime`"
[this]
(-> this (.-startTime)))
(defn set-start-time!
"Property.
The Animation.startTime property of the `web.animation.Animation`
is a double-precision floating-point value which indicates the
time when an animation's playback should begin.
`var animationStartedWhen = Animation.startTime;
Animation.startTime = newStartTime;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/Animation/startTime`"
[this val]
(aset this "startTime" val))
(defn timeline
"Property.
The Animation.timeline property of the `web.animation.Animation`
returns or sets the `timeline` associated with this animation.
timeline is a source of time values for synchronization purposes,
is an `web.animation.AnimationTimeline`-based object. By default,
animation's timeline and the `web.Document`'s timeline are the
`var animationsTimeline = Animation.timeline;
Animation.timeline = newTimeline;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/Animation/timeline`"
[this]
(-> this (.-timeline)))
(defn set-timeline!
"Property.
The Animation.timeline property of the `web.animation.Animation`
returns or sets the `timeline` associated with this animation.
timeline is a source of time values for synchronization purposes,
is an `web.animation.AnimationTimeline`-based object. By default,
animation's timeline and the `web.Document`'s timeline are the
`var animationsTimeline = Animation.timeline;
Animation.timeline = newTimeline;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/Animation/timeline`"
[this val]
(aset this "timeline" val))
(defn oncancel
"Property.
The oncancel property of the Web Animations API's `web.animation.Animation`
is the event handler for the cancel event.
`var cancelHandler = Animation.oncancel;
Animation.oncancel = cancelHandler;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/Animation/oncancel`"
[this]
(-> this (.-oncancel)))
(defn set-oncancel!
"Property.
The oncancel property of the Web Animations API's `web.animation.Animation`
is the event handler for the cancel event.
`var cancelHandler = Animation.oncancel;
Animation.oncancel = cancelHandler;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/Animation/oncancel`"
[this val]
(aset this "oncancel" val))
(defn onfinish
"Property.
The `web.animation.Animation` interface's onfinish property (from
Web Animations API) is the event handler for the finish event.
event is sent when the animation finishes playing.
`var finishHandler = Animation.onfinish;
Animation.onfinish = finishHandler;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/Animation/onfinish`"
[this]
(-> this (.-onfinish)))
(defn set-onfinish!
"Property.
The `web.animation.Animation` interface's onfinish property (from
Web Animations API) is the event handler for the finish event.
event is sent when the animation finishes playing.
`var finishHandler = Animation.onfinish;
Animation.onfinish = finishHandler;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/Animation/onfinish`"
[this val]
(aset this "onfinish" val))