-
Notifications
You must be signed in to change notification settings - Fork 16
/
hubspokes.html
259 lines (230 loc) · 9.02 KB
/
hubspokes.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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hub and Spoke Transaction Visualization</title>
<style>
.visualization-container {
width: 100%;
height: 80vh;
position: relative;
background: #1a1a1a;
border-radius: 8px;
margin-bottom: 20px;
}
.controls-container {
padding: 20px;
background: #2a2a2a;
border-radius: 8px;
display: flex;
flex-direction: column;
gap: 20px;
}
.top-controls {
display: flex;
justify-content: space-between;
align-items: center;
padding-bottom: 15px;
border-bottom: 1px solid #444;
}
.control-button {
background: #4CAF50;
color: white;
border: none;
padding: 8px 16px;
border-radius: 4px;
cursor: pointer;
}
.control-button.active {
background: #f44336;
}
.slider-controls {
display: flex;
gap: 20px;
flex-wrap: wrap;
}
.slider-group {
margin-bottom: 15px;
}
.slider-label {
display: block;
color: #ffffff;
margin-bottom: 5px;
}
.slider {
width: 100%;
margin-bottom: 10px;
}
.user {
r: 8;
}
.checkbox-container {
color: white;
}
.visualization-container {
position: relative;
}
</style>
<script src="https://d3js.org/d3.v7.min.js"></script>
<script src="visualization.js" defer></script>
</head>
<body>
<div class="visualization-container" id="visualization">
<!-- SVG will be injected here by JavaScript -->
</div>
<div class="controls-container">
<div class="top-controls">
<button id="transactionControl" class="control-button">
Start Transactions
</button>
<div class="checkbox-container">
<label>
<input type="checkbox" id="counterToggle">
Show Transaction Counters
</label>
</div>
</div>
<div class="slider-controls">
<div class="slider-group">
<label class="slider-label">
Motion Time (ms): <span id="motionTimeValue">1000</span>
<input type="range" id="motionTimeControl" class="slider"
min="10" max="3000" value="1000" step="10">
</label>
</div>
<div class="slider-group">
<label class="slider-label">
Hub Time (ms): <span id="hubTimeValue">500</span>
<input type="range" id="hubTimeControl" class="slider"
min="0" max="1000" value="500" step="10">
</label>
</div>
<div class="slider-group">
<label class="slider-label">
L2 TPS: <span id="l2TPSValue">1.0</span>
<input type="range" id="l2TPSControl" class="slider"
min="0.1" max="100" value="1.0" step="0.1">
</label>
</div>
<div class="slider-group">
<label class="slider-label">
L1 TPS: <span id="l1TPSValue">1.0</span>
<input type="range" id="l1TPSControl" class="slider"
min="0.1" max="100" value="1.0" step="0.1">
</label>
</div>
<div class="slider-group">
<label class="slider-label">
Number of Hubs: <span id="hubsValue">1</span>
<input type="range" id="hubsControl" class="slider"
min="1" max="20" value="1" step="1">
</label>
</div>
<div class="slider-group">
<label class="slider-label">
Number of Users: <span id="usersValue">10</span>
<input type="range" id="usersControl" class="slider"
min="1" max="100" value="10" step="1">
</label>
</div>
<div class="slider-group">
<label class="slider-label">
Position Variation: <span id="variationValue">0</span>
<input type="range" id="variationControl" class="slider"
min="0" max="50" value="0" step="1">
</label>
</div>
<div class="slider-group">
<label class="slider-label">
Hub Position Variation: <span id="hubVariationValue">0</span>
<input type="range" id="hubVariationControl" class="slider"
min="0" max="50" value="0" step="1">
</label>
</div>
<div class="slider-group">
<label class="slider-label">
Hub Size: <span id="hubSizeValue">10</span>
<input type="range" id="hubSizeControl" class="slider"
min="1" max="20" value="10" step="1">
</label>
</div>
<div class="slider-group">
<label class="slider-label">
User Size: <span id="userSizeValue">5</span>
<input type="range" id="userSizeControl" class="slider"
min="1" max="20" value="5" step="1">
</label>
</div>
<div class="slider-group">
<label class="slider-label">
Transaction Dot Size: <span id="dotSizeValue">3</span>
<input type="range" id="dotSizeControl" class="slider"
min="1" max="20" value="3" step="1">
</label>
</div>
<div class="slider-group">
<label class="slider-label">
Rebalance Rate (TPS): <span id="rebalanceRateValue">1</span>
<input type="range" id="rebalanceRateControl" class="slider"
min="0.1" max="100" value="1" step="0.1">
</label>
</div>
<div class="control-group">
<label class="control-label">
Broadcast Style:
<select id="broadcastStyleControl" class="select">
<option value="ripple">Circular Ripple</option>
<option value="directed">Directed Ripples</option>
<option value="flash">Flash</option>
<option value="rays">Rays</option>
<option value="pulse">Pulse</option>
</select>
</label>
</div>
<div class="slider-group">
<label class="slider-label">
Onchain TX Size: <span id="onchainSizeValue">8</span>
<input type="range" id="onchainSizeControl" class="slider"
min="1" max="20" value="8" step="1">
</label>
</div>
<div class="slider-group">
<label class="slider-label">
Number of Depositories: <span id="depositoriesValue">3</span>
<input type="range" id="depositoriesControl" class="slider"
min="1" max="10" value="3" step="1">
</label>
</div>
<div class="slider-group">
<label class="slider-label">
Depository Position:
<select id="depositoryPositionControl">
<option value="top">Top</option>
<option value="left">Left</option>
<option value="right">Right</option>
<option value="bottom">Bottom</option>
</select>
</label>
</div>
<div class="slider-group">
<label class="slider-label">
Block Size: <span id="blockSizeValue">6</span>
<input type="range" id="blockSizeControl" class="slider"
min="2" max="12" value="6" step="1">
</label>
</div>
<div class="control-group">
<label class="control-label">
Color Scheme:
<select id="colorSchemeControl" class="select">
<option value="anthropic">Anthropic</option>
<option value="modern">Modern</option>
<option value="classic">Classic</option>
</select>
</label>
</div>
</div>
</div>
</body>
</html>