OLD | NEW |
| (Empty) |
1 <!-- | |
2 Copyright 2014 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 <svg xmlns="http://www.w3.org/2000/svg" version="1.1" id="svg"></svg> | |
19 | |
20 <script src="../bootstrap.js"></script> | |
21 <script> | |
22 'use strict'; | |
23 | |
24 var startPath = 'M10,10v100l100,-50z'; | |
25 var endPath = 'M200,10v100h100v-100z'; | |
26 | |
27 function addPath(d, fill) { | |
28 var path = document.createElementNS('http://www.w3.org/2000/svg', 'path'); | |
29 if (d) | |
30 path.setAttribute('d', d); | |
31 path.setAttribute('fill', fill); | |
32 svg.appendChild(path); | |
33 return path; | |
34 } | |
35 | |
36 addPath(startPath, 'red'); | |
37 addPath(endPath, 'red'); | |
38 var target = addPath(startPath, 'green'); | |
39 target.classList.add('target'); | |
40 target.animate({d: endPath}, 1000); | |
41 </script> | |
OLD | NEW |