forked from web-animations/web-animations-js-legacy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-path.html
More file actions
81 lines (69 loc) · 2.04 KB
/
Copy pathtest-path.html
File metadata and controls
81 lines (69 loc) · 2.04 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
<!--
Copyright 2012 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE html>
<style>
#anim1, #anim2 {
position: absolute;
width: 25px;
height: 25px;
top: 0px;
left: 0px;
background: lightsteelblue;
}
.expectation {
background: red;
position: absolute;
width: 25px;
height: 25px;
top: 0px;
left: 0px;
}
#e1 {
transform: translate(87.5px, 87.5px);
-webkit-transform: translate(87.5px, 87.5px);
}
#e2 {
transform: translate(87.5px, 237.5px) rotate(63.33deg);
-webkit-transform: translate(87.5px, 237.5px) rotate(63.33deg);
}
svg {
position:absolute;
top: 0px;
left: 0px;
width: 500px;
height: 500px;
}
</style>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<path id=path1 d="M 100,100 a 75,75 0 1,0 150,0 a 75,75 0 1,0 -150,0 " stroke="black" stroke-width="1" fill="none" />
<path id=path2 d="M 100 250 L 300 250 L 200 450 z" stroke="black" stroke-width="1" fill="none" />
</svg>
<div id="e1" class="expectation"></div>
<div id="anim1">→</div>
<div id="e2" class="expectation"></div>
<div id="anim2">→</div>
<script src="web-animation.js"></script>
<script>
var animFunc = new PathAnimationFunction(
document.querySelector('#path1'));
animFunc.rotate = true;
var anim = new Animation(document.querySelector("#anim1"),
animFunc,
{duration: 2, iterationCount: 2});
var animFunc2 = new PathAnimationFunction(
document.querySelector('#path2'));
animFunc2.rotate = true;
var anim2 = new Animation(document.querySelector("#anim2"),
animFunc2,
{duration: 2, iterationCount: 2});
</script>