OLD | NEW |
| (Empty) |
1 <!-- | |
2 Copyright 2012 Google Inc. All Rights Reserved. | |
3 | |
4 Licensed under the Apache License, Version 2.0 (the "License"); | |
5 you may not use this file except in compliance with the License. | |
6 You may obtain a copy of the License at | |
7 | |
8 http://www.apache.org/licenses/LICENSE-2.0 | |
9 | |
10 Unless required by applicable law or agreed to in writing, software | |
11 distributed under the License is distributed on an "AS IS" BASIS, | |
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 See the License for the specific language governing permissions and | |
14 limitations under the License. | |
15 --> | |
16 | |
17 <!DOCTYPE html><meta charset="UTF-8"> | |
18 <style> | |
19 .animation { | |
20 position: absolute; | |
21 width: 25px; | |
22 height: 25px; | |
23 top: 0px; | |
24 left: 0px; | |
25 background: lightsteelblue; | |
26 } | |
27 .expectation { | |
28 background: red; | |
29 position: absolute; | |
30 width: 25px; | |
31 height: 25px; | |
32 top: 0px; | |
33 left: 0px; | |
34 } | |
35 #eTR { | |
36 -webkit-transform: translate(387.5px, 87.5px); | |
37 transform: translate(387.5px, 87.5px); | |
38 } | |
39 #eBL { | |
40 -webkit-transform: translate(87.5px, 287.5px); | |
41 transform: translate(87.5px, 287.5px); | |
42 } | |
43 #eBR, #animBR { | |
44 -webkit-transform: translate(387.5px, 287.5px); | |
45 transform: translate(387.5px, 287.5px); | |
46 } | |
47 svg { | |
48 position:absolute; | |
49 top: 0px; | |
50 left: 0px; | |
51 width: 800px; | |
52 height: 600px; | |
53 } | |
54 </style> | |
55 | |
56 <svg xmlns="http://www.w3.org/2000/svg" version="1.1"> | |
57 <path id=pathTR d="M400,100l0,0l0,-50l100,0l86.3325,122.665z" /> | |
58 <path d="M400,100l0,0l0,-50l100,0l86.3325,122.665z" stroke="black" | |
59 stroke-width="1" fill="none" /> | |
60 <path id=pathBL d="M100,300l0,0l0,-50l100,0l86.3325,122.665z" /> | |
61 <path d="M100,300l0,0l0,-50l100,0l86.3325,122.665z" stroke="black" | |
62 stroke-width="1" fill="none" /> | |
63 <path id=pathBR d="M400,300l0,0l0,-50l100,0l86.3325,122.665z" /> | |
64 <path d="M400,300l0,0l0,-50l100,0l86.3325,122.665z" stroke="black" | |
65 stroke-width="1" fill="none" /> | |
66 </svg> | |
67 | |
68 <div id="eTR" class="expectation"></div> | |
69 <div id="animTR" class="animation">→</div> | |
70 <div id="eBL" class="expectation"></div> | |
71 <div id="animBL" class="animation">→</div> | |
72 <div id="eBR" class="expectation"></div> | |
73 <div id="animBR" class="animation">→</div> | |
74 | |
75 <script> | |
76 var expected_failures = [ | |
77 { | |
78 browser_configurations: [{ firefox: true }], | |
79 tests: [ | |
80 '#animTR at t=(0|(1|2|9|10|11)000)ms', | |
81 '#animBL at t=(0|(5|7|8|10)000)ms', | |
82 '#animBR at t=(0|(3|8|9|10)000)ms', | |
83 ], | |
84 message: 'Doesn\'t quite follow path correctly.', | |
85 }, { | |
86 browser_configurations: [{ msie: true }], | |
87 tests: [ | |
88 '#animTR at t=(0|(1|2|3|4|9|10|11)000)ms', | |
89 '#animBL at t=(0|(1|3|4|7|8|10|11)000)ms', | |
90 '#animBR at t=(0|(1|3|9|10|11)000)ms', | |
91 ], | |
92 message: 'Doesn\'t quite follow path correctly.', | |
93 } | |
94 ]; | |
95 </script> | |
96 <script src="../bootstrap.js"></script> | |
97 <script> | |
98 "use strict"; | |
99 | |
100 var animFuncTR = new MotionPathEffect( | |
101 document.querySelector('#pathTR').pathSegList, 'auto-rotate'); | |
102 document.timeline.play(new Animation(document.querySelector("#animTR"), | |
103 animFuncTR, {duration: 10 * 1000, iterations: 2})); | |
104 | |
105 var animFuncBL = new MotionPathEffect( | |
106 document.querySelector('#pathBL').pathSegList, 'auto-rotate'); | |
107 document.timeline.play(new Animation( | |
108 document.querySelector("#animBL"), animFuncBL, | |
109 {duration: 10 * 1000, iterations: 2, easing: "paced"})); | |
110 | |
111 var animFuncBRKeyFrames = new KeyframeEffect( | |
112 [{transform: "translate(387.5px, 287.5px) rotate(180deg)"}], "replace"); | |
113 var animFuncBRPath = new MotionPathEffect( | |
114 document.querySelector('#pathBR').pathSegList, 'auto-rotate'); | |
115 var animBR = new Animation(document.querySelector("#animBR"), animFuncBRPath, | |
116 {duration: 10 * 1000, iterations: 2, easing: "paced"}); | |
117 document.timeline.play(animBR); | |
118 | |
119 testharness_timeline.schedule(function() { | |
120 animBR.effect = animFuncBRKeyFrames; | |
121 }, 3000); | |
122 testharness_timeline.schedule(function() { | |
123 animBR.effect = animFuncBRPath; | |
124 }, 6000); | |
125 </script> | |
OLD | NEW |