-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.html
134 lines (134 loc) · 8.42 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
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="favicon.ico" />
<meta name="description" content="A simple, chaotic gravity simulator">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" type="image/x-icon" href="/favicon.ico">
<link rel="manifest" href="/manifest.json">
<script src="/registerSW.js"></script>
<title>Gravity Sandbox</title>
</head>
<body>
<div class="menu-bar">
<svg width="15" height="14" viewBox="0 0 15 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="6.84935" cy="6.84935" r="3.75609" fill="#88C6FF"/>
<path d="M13.8092 6.90458C13.8092 5.32718 13.269 3.79733 12.2787 2.56958C11.2883 1.34183 9.90743 0.490197 8.36576 0.156381C6.82408 -0.177435 5.21458 0.0266927 3.80505 0.734801C2.39552 1.44291 1.27095 2.6123 0.61844 4.04842C-0.0340709 5.48453 -0.175175 7.10077 0.218606 8.62823C0.612386 10.1557 1.51731 11.5023 2.78281 12.4439C4.04831 13.3856 5.59808 13.8655 7.17428 13.8039C8.75047 13.7423 10.2581 13.1428 11.4462 12.1053L10.9109 11.4923C9.86279 12.4075 8.5329 12.9363 7.14249 12.9907C5.75208 13.045 4.38497 12.6217 3.26863 11.791C2.1523 10.9603 1.35404 9.77249 1.00667 8.42507C0.659305 7.07765 0.783777 5.65191 1.35938 4.38507C1.93498 3.11823 2.927 2.08667 4.17039 1.46202C5.41378 0.837378 6.83357 0.657311 8.19353 0.95178C9.55349 1.24625 10.7716 1.9975 11.6452 3.08054C12.5189 4.16358 12.9953 5.51311 12.9953 6.90458H13.8092Z" fill="#88C6FF"/>
<circle cx="13.4225" cy="7.23602" r="1.0495" fill="#88C6FF"/>
</svg>
<div class="menu">
File
<ul class="menu__list">
<li id="new">New<span class="shortcut">CTRL+M</span></li>
<li id="open">
Open
<ul class="sub-menu__list">
<li class="disabled">Empty</li>
</ul>
</li>
<li id="save">Save<span class="shortcut">CTRL+S</span></li>
</ul>
</div>
<div class="menu">
Edit
<ul class="menu__list">
<li id="undo">Undo<span class="shortcut">CTRL+Z</span></li>
<li id="redo">Redo<span class="shortcut">CTRL+Y</span></li>
<li id="delete">Delete Selected<span class="shortcut">Delete</span></li>
</ul>
</div>
<div class="menu" id="about">
About
</div>
<input type="text" id="filename" oninput="this.size = this.value.length" value="Untitled" size="8">
</div>
<canvas id="canvas" oncontextmenu="return false;"></canvas>
<div class="tool-bar">
<button class="btn" id="play-pause-btn">
</button>
<button class="btn" id="add-btn" onclick="this.blur();">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12 4C11.4477 4 11 4.44772 11 5V11H5C4.44772 11 4 11.4477 4 12C4 12.5523 4.44772 13 5 13H11V19C11 19.5523 11.4477 20 12 20C12.5523 20 13 19.5523 13 19V13H19C19.5523 13 20 12.5523 20 12C20 11.4477 19.5523 11 19 11H13V5C13 4.44772 12.5523 4 12 4Z" fill="white" /></svg>
</button>
<button class="btn" id="pan-btn" onclick="this.blur();">
<svg width="24" height="24" viewBox="0 0 24 24" fill="white" xmlns="http://www.w3.org/2000/svg"><path d="M14.8284 6.34313L16.2426 4.92892L12 0.686279L7.75735 4.92892L9.17156 6.34313L12 3.51471L14.8284 6.34313Z" fill="white" /><path d="M4.92892 16.2426L6.34313 14.8284L3.51471 12L6.34313 9.17156L4.92892 7.75735L0.686279 12L4.92892 16.2426Z" fill="white" /><path d="M7.75735 19.0711L12 23.3137L16.2426 19.0711L14.8284 17.6568L12 20.4853L9.17156 17.6568L7.75735 19.0711Z" fill="white" /><path d="M17.6568 9.17156L20.4853 12L17.6568 14.8284L19.0711 16.2426L23.3137 12L19.0711 7.75735L17.6568 9.17156Z" fill="white" /><path fill-rule="evenodd" clip-rule="evenodd" d="M12 8C14.2091 8 16 9.79086 16 12C16 14.2091 14.2091 16 12 16C9.79086 16 8 14.2091 8 12C8 9.79086 9.79086 8 12 8ZM12 10C13.1046 10 14 10.8954 14 12C14 13.1046 13.1046 14 12 14C10.8954 14 10 13.1046 10 12C10 10.8954 10.8954 10 12 10Z" fill="white" /></svg>
</button>
<button class="btn" id="select-btn" onclick="this.blur();">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M6.5 6.5H17.5V17.5H6.5V6.5Z" stroke="white" stroke-width="3" /></svg>
</button>
<button class="btn" id="clear-btn">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M3.49997 12.8995C2.71892 13.6805 2.71892 14.9468 3.49997 15.7279L7.35785 19.5858H4.08576C3.53347 19.5858 3.08576 20.0335 3.08576 20.5858C3.08576 21.1381 3.53347 21.5858 4.08576 21.5858H20.0858C20.638 21.5858 21.0858 21.1381 21.0858 20.5858C21.0858 20.0335 20.638 19.5858 20.0858 19.5858H10.9558L20.4705 10.071C21.2516 9.28999 21.2516 8.02366 20.4705 7.24261L16.2279 2.99997C15.4468 2.21892 14.1805 2.21892 13.3995 2.99997L3.49997 12.8995ZM7.82579 11.4021L4.91418 14.3137L9.15683 18.5563L12.0684 15.6447L7.82579 11.4021ZM9.24 9.98787L13.4826 14.2305L19.0563 8.65683L14.8137 4.41418L9.24 9.98787Z" fill="white" /></svg>
</button>
<div class="btn" id="box-btn">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10 12C9.44769 12 9 12.4477 9 13C9 13.5523 9.44769 14 10 14H14C14.5522 14 15 13.5523 15 13C15 12.4477 14.5522 12 14 12H10Z" fill="white" /><path fill-rule="evenodd" clip-rule="evenodd" d="M4 2C2.34314 2 1 3.34314 1 5V19C1 20.6569 2.34314 22 4 22H20C21.6569 22 23 20.6569 23 19V5C23 3.34314 21.6569 2 20 2H4ZM20 4H4C3.44769 4 3 4.44769 3 5V8H21V5C21 4.44769 20.5522 4 20 4ZM3 19V10H21V19C21 19.5523 20.5522 20 20 20H4C3.44769 20 3 19.5523 3 19Z" fill="white" /></svg>
<div id="box">
<button id="set-orbit">Orbit</button>
<button id="set-grid">Grid</button>
<button id="set-infinity">Infinity</button>
<button id="set-circle">Circle</button>
<button id="set-square">Square</button>
<button id="set-sinewave">Sine Wave</button>
</div>
</div>
</div>
<div class="sliders-container">
<div class="sliders">
<div class="slider">
<label for="mass">Mass</label>
<input type="number" id="mass" value="10">
</div>
<div class="slider">
<label for="color">Color</label>
<input type="text" id="color" value="random">
</div>
</div>
<div class="sliders">
<div class="slider">
<label for="speed">Speed</label>
<input type="number" id="speed" value="50">
</div>
<div class="slider">
<label for="gravity">Gravity</label>
<input type="number" id="gravity" value="100">
</div>
</div>
</div>
<div class="window hidden" id="about-window">
<span class="close-btn">Close</span>
<h2 style="text-align: center;">Gravity Sandbox</h2>
<p>
Gravity Sandbox is a fun toy/game where you can play with Newtonian Gravity.
Place heavy objects in patterns and see interesting results.
</p>
<h3>Controls</h3>
<p>
On the left side, there are 5 buttons for Play/Pause, Place Mode, Pan Mode, Selection Mode, Clear All, and Load Presets.
</p>
<p>
On the right side, the <code>Mass</code> and <code>Color</code> properties are for
new bodies and <code>Speed</code> and <code>Gravity</code> are for simulation.
</p>
<h3>Shortcuts</h3>
<ul>
<li>Pause/Play: <code>space</code></li>
<li>Place Mode: <code>p</code></li>
<li>Pan Mode: <code>h</code></li>
<li>Selection Mode: <code>s</code></li>
<li>Clear All: <code>c</code></li>
<li>Undo: <code>CTRL + Z</code></li>
<li>Redo: <code>CTRL + Y</code></li>
<li>Delete Selection: <code>delete</code></li>
<li>New File: <code>CTRL + M</code></li>
<li>Save File: <code>CTRL + S</code></li>
</ul>
</div>
<div class="info-bar" id="info-bar"></div>
<div class="links">
<a href="https://github.com/siddharthroy12/Gravity-Sandbox" target="_blank">Source Code</a> |
<a href="https://twitter.com/reactoverflow" target="_blank">Author</a> |
<a href="https://github.com/siddharthroy12/Gravity-Sandbox/issues" target="_blank">Report a bug</a> |
<span>Version 1.3.1</span>
</div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>