-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
50 lines (38 loc) · 1.1 KB
/
index.html
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
<script src="js/svg.js"></script>
<script src="js/export.svg.js"></script>
<script src="js/dat.gui.min.js"></script>
<script src="js/fileSaver.js"></script>
<body>
<div id="canvas"></div>
</body>
<script src="js/gears.js"></script>
<script>
// create svg image in webpage
var draw = window.draw = SVG('canvas').size(window.innerWidth, window.innerHeight);
var gear = new Gear();
var gui = new dat.GUI();
gui.add(gear, 'teeth', 2, 30).step(1).onChange(function(){
gear.render(draw);
})
var advanced = gui.addFolder('Advanced');
advanced.add(gear, 'mm_per_tooth', 1, 100).onChange(function(){
gear.render(draw);
})
advanced.add(gear, 'axle_radius', 1,200).onChange(function(){
gear.render(draw);
})
advanced.add(gear, 'backlash', 0, 20).onChange(function(){
gear.render(draw);
})
advanced.add(gear, 'clearance', 0, 20).onChange(function(){
gear.render(draw);
})
advanced.open();
gui.add(gear, 'Save_SVG');
// Draw it
gear.render(draw)
window.onresize = function(){
draw.size(window.innerWidth, window.innerHeight);
gear.render(draw);
}
</script>