-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
88 lines (75 loc) · 3.4 KB
/
index.html
File metadata and controls
88 lines (75 loc) · 3.4 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<script type="text/javascript">
var scr = document.createElement('script');
scr.type = 'text/javascript';
if(navigator.userAgent.indexOf("Firefox") != -1 )
scr.src = "firefoxfix.js"
else
scr.src = "script.js"
document.head.appendChild(scr);
</script>
<title>Document</title>
</head>
<body>
<div class="container">
<h1>Electric Field Simulator</h1>
<h3>How to use</h3>
<p>Left click to create a positive charge. Right click to create a negative charge (If on mobile use the options)</p>
<p>Use the options at the bottom to change the physics timescale, image resolution, # of physics subsamples, friction, charge, trails, and static charges.</p>
<p>(Note, this will run on firefox, but is optimized for chrome and is a lot more performant, especially with resolution)</p>
<div>
<canvas> </canvas>
</div>
<!-- Controls -->
<div class="hidden">
<label for="positive" style="display: inline">Positive:</label>
<input type="checkbox" id="positive" checked>
</div>
<div>
<label for="timescale">Timescale:</label>
<input type="range" min="-2" max="1" step="0.01" id="timescale" oninput="document.getElementById('timescale_output').value = Math.pow(10,this.value).toFixed(2)">
<output id=timescale_output>1</output>
</div>
<div>
<label for="Resolution">Resolution:</label>
<input type="range" min="1" max="20" step="1" value="10" id="resolution" oninput="document.getElementById('resolution_output').value = this.value">
<output id=resolution_output>10</output>
</div>
<div>
<label for="physicssubsamples">Subsamples:</label>
<input type="range" min="100" max="10000" step="100" value="5000" id="physicssubsamples" oninput="document.getElementById('physicssubsamples_output').value = this.value">
<output id=physicssubsamples_output>5000</output>
</div>
<div>
<label for="friction">Friction:</label>
<input type="range" min="0" max="0.2" step="0.001" value="0" id="friction" oninput="document.getElementById('friction_output').value = this.value">
<output id=friction_output>0</output>
</div>
<div>
<label for="charge">Charge:</label>
<input type="range" min="100" max="1600" step="50" value="800" id="charge" oninput="document.getElementById('charge_output').value = this.value">
<output id=charge_output>800</output>
</div>
<div>
<label for="trail">Trails:</label>
<input type="checkbox" id="trail" checked>
</div>
<div>
<label for="static">Static:</label>
<input type="checkbox" id="static">
</div>
<div>
<button type="button" id="reset" onclick="charges = [];">Reset</button>
</div>
</div>
</body>
<footer>
<a href="https://github.com/JoshGreenslade/ElectricField/">Look at the code here</a>
</footer>
</html>