1 | <!doctype html>
|
2 | <html>
|
3 | <head>
|
4 | <title>Graph 3D animation demo</title>
|
5 |
|
6 | <style type="text/css">
|
7 | body {
|
8 | font: 10pt arial;
|
9 | }
|
10 | </style>
|
11 |
|
12 | <script type="text/javascript" src="../../dist/vis-graph3d.min.js"></script>
|
13 |
|
14 | <script type="text/javascript">
|
15 | var data = null;
|
16 | var graph = null;
|
17 |
|
18 | function custom(x, y, t) {
|
19 | return Math.sin(x/50 + t/10) * Math.cos(y/50 + t/10) * 50 + 50;
|
20 | }
|
21 |
|
22 |
|
23 | function drawVisualization() {
|
24 |
|
25 | data = new vis.DataSet();
|
26 |
|
27 | var steps = 25;
|
28 | var axisMax = 314;
|
29 | var tMax = 31;
|
30 | var axisStep = axisMax / steps;
|
31 | for (var t = 0; t < tMax; t++) {
|
32 | for (var x = 0; x < axisMax; x+=axisStep) {
|
33 | for (var y = 0; y < axisMax; y+=axisStep) {
|
34 | var value = custom(x, y, t);
|
35 | data.add([
|
36 | {x:x,y:y,z:value,filter:t,style:value}
|
37 | ]);
|
38 | }
|
39 | }
|
40 | }
|
41 |
|
42 |
|
43 | var options = {
|
44 | width: '600px',
|
45 | height: '600px',
|
46 | style: 'surface',
|
47 | showPerspective: true,
|
48 | showGrid: true,
|
49 | showShadow: false,
|
50 |
|
51 | keepAspectRatio: true,
|
52 | verticalRatio: 0.5,
|
53 | animationInterval: 100,
|
54 | animationPreload: true
|
55 | };
|
56 |
|
57 |
|
58 | var container = document.getElementById('mygraph');
|
59 | graph = new vis.Graph3d(container, data, options);
|
60 | }
|
61 | </script>
|
62 |
|
63 | </head>
|
64 |
|
65 | <body onload="drawVisualization();">
|
66 | <div id="mygraph"></div>
|
67 |
|
68 | <div id="info"></div>
|
69 | </body>
|
70 | </html>
|