equal
deleted
inserted
replaced
|
1 <!DOCTYPE html> |
|
2 <html> |
|
3 <head> |
|
4 <title>Hello, transition undefined!</title> |
|
5 <script type="text/javascript" src="../../d3.js"></script> |
|
6 <style type="text/css"> |
|
7 |
|
8 body { |
|
9 font: 14px Helvetica Neue; |
|
10 text-rendering: optimizeLegibility; |
|
11 margin: 1em; |
|
12 } |
|
13 |
|
14 div { |
|
15 font-size: 42px; |
|
16 margin-top: .5em; |
|
17 text-align: right; |
|
18 } |
|
19 |
|
20 </style> |
|
21 </head> |
|
22 <body> |
|
23 Your lucky number is:<br> |
|
24 <div>hello</div> |
|
25 <script type="text/javascript"> |
|
26 |
|
27 transform(); |
|
28 |
|
29 function transform() { |
|
30 d3.select("div") |
|
31 .style("width", "0%") |
|
32 .transition() |
|
33 .ease("bounce") |
|
34 .duration(2000) |
|
35 .style("width", "100%") |
|
36 .style("background-color", function() { return d3.hsl(180, Math.random(), .5); }); |
|
37 } |
|
38 |
|
39 window.addEventListener("keypress", transform, false); |
|
40 |
|
41 </script> |
|
42 </body> |
|
43 </html> |