Skip to content

Commit db946d7

Browse files
adding web animations api examples
1 parent a4974ec commit db946d7

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

web-animations-api/README.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#auxclick demo
2+
3+
Some simple demos to show Web Animations API features.
4+
5+
## Implicit to/from keyframes
6+
That is, when you write an animation, you can leave out the end state of the animation from the keyframes, and the browser will infer it, if it can. For example:
7+
8+
```
9+
let rotate360 = [
10+
{ transform: 'rotate(360deg)' }
11+
];
12+
```
13+
14+
[See the demo live](https://mdn.github.io/dom-examples/web-animations-api/implicit-keyframes.html).
15+
16+
+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<!doctype html>
2+
<html lang="en-US">
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<title>Web Animations API implicit keyframes</title>
7+
<style>
8+
html {
9+
height: 100%;
10+
}
11+
12+
body {
13+
margin: 0;
14+
height: inherit;
15+
display: flex;
16+
justify-content: center;
17+
align-items: center;
18+
}
19+
20+
div {
21+
width: 150px;
22+
height: 100px;
23+
background-color: red;
24+
border: 10px solid black;
25+
border-radius: 10px;
26+
}
27+
</style>
28+
</head>
29+
30+
<body>
31+
<div>
32+
33+
</div>
34+
35+
<script>
36+
const divElem = document.querySelector('div');
37+
38+
let rotate360 = [
39+
{ transform: 'rotate(360deg)' }
40+
];
41+
42+
let slowInfinite = {
43+
duration: 5000,
44+
iterations: Infinity
45+
}
46+
47+
divElem.animate( rotate360, slowInfinite );
48+
49+
</script>
50+
</body>
51+
52+
</html>

0 commit comments

Comments
 (0)