-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.html
More file actions
executable file
·372 lines (347 loc) · 20.3 KB
/
Copy pathapp.html
File metadata and controls
executable file
·372 lines (347 loc) · 20.3 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
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
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>NeoMatrix Frame Creator - LED Matrix Animation Designer</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<!-- SEO Meta Tags -->
<meta name="description" content="Design stunning LED matrix animations for WS2812 NeoPixel displays. Create multi-color pixel art, preview scrolling animations, and export to Rust code or GIF.">
<meta name="keywords" content="LED matrix, NeoPixel, WS2812, animation editor, pixel art, Arduino, ESP32, Rust, smart LEDs, RGB matrix, frame creator">
<meta name="author" content="Technical-1">
<meta name="robots" content="index, follow">
<meta name="theme-color" content="#0a0a0f">
<!-- Open Graph / Facebook -->
<meta property="og:type" content="website">
<meta property="og:url" content="https://technical-1.github.io/NeoMatrix-FrameCreator/app.html">
<meta property="og:title" content="NeoMatrix Frame Creator">
<meta property="og:description" content="Design stunning LED matrix animations for WS2812 NeoPixel displays. Create pixel art, preview animations, export to Rust or GIF.">
<meta property="og:image" content="https://technical-1.github.io/NeoMatrix-FrameCreator/og-image.png">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta property="og:site_name" content="NeoMatrix Frame Creator">
<!-- Twitter Card -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:url" content="https://technical-1.github.io/NeoMatrix-FrameCreator/app.html">
<meta name="twitter:title" content="NeoMatrix Frame Creator">
<meta name="twitter:description" content="Design stunning LED matrix animations for WS2812 NeoPixel displays. Create pixel art, preview animations, export to Rust or GIF.">
<meta name="twitter:image" content="https://technical-1.github.io/NeoMatrix-FrameCreator/og-image.png">
<!-- Favicon -->
<link rel="icon" type="image/svg+xml" href="favicon.svg">
<link rel="icon" type="image/png" sizes="32x32" href="favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png">
<link rel="apple-touch-icon" sizes="180x180" href="apple-touch-icon.png">
<!-- Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
<!-- Canonical URL -->
<link rel="canonical" href="https://technical-1.github.io/NeoMatrix-FrameCreator/app.html">
<link rel="stylesheet" href="style.css">
</head>
<body>
<!-- Header with collapsible info -->
<header class="site-header">
<div class="header-main">
<h1 class="logo">
<span class="logo-icon" aria-hidden="true"></span>
NeoMatrix
</h1>
<div class="header-actions">
<a class="btn btn-icon home-link" href="index.html?home=1" aria-label="About this project" title="About">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/>
<polyline points="9 22 9 12 15 12 15 22"/>
</svg>
</a>
<!-- Undo/Redo buttons -->
<button class="btn btn-icon" id="undo-btn" onclick="undo()" aria-label="Undo" title="Undo (Ctrl+Z)" disabled>
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M3 7v6h6"/>
<path d="M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"/>
</svg>
</button>
<button class="btn btn-icon" id="redo-btn" onclick="redo()" aria-label="Redo" title="Redo (Ctrl+Y)" disabled>
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 7v6h-6"/>
<path d="M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7"/>
</svg>
</button>
<button class="info-toggle" id="info-toggle" aria-expanded="false" aria-controls="info-panel">
<span class="sr-only">Toggle help panel</span>
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="10"/>
<path d="M12 16v-4M12 8h.01"/>
</svg>
</button>
</div>
</div>
<div class="info-panel" id="info-panel" hidden>
<p>Design LED matrix frames for your <strong>WS2812 NeoPixel</strong> animations. Click cells to toggle pixels, manage frames, preview scrolling, and export to JSON or Rust code.</p>
<div class="info-shortcuts">
<span><kbd>Ctrl</kbd>+<kbd>Z</kbd> Undo</span>
<span><kbd>Ctrl</kbd>+<kbd>Y</kbd> Redo</span>
<span><kbd>Ctrl</kbd>+<kbd>←/→</kbd> Navigate frames</span>
<span><kbd>Space</kbd> Play/Stop</span>
</div>
<div class="info-meta">
<span>Originally built for UF CEN4907C</span>
<a href="https://github.com/Technical-1/NeoMatrix-FrameCreator" target="_blank" rel="noopener">GitHub</a>
</div>
</div>
</header>
<main class="app-main">
<!-- Primary Toolbar -->
<nav class="toolbar" role="toolbar" aria-label="Grid controls">
<!-- Grid Settings Group -->
<div class="toolbar-group">
<label class="toolbar-label">Size</label>
<div class="size-inputs">
<input
type="number"
id="grid-width-input"
min="1"
max="64"
value="8"
aria-label="Grid width (1-64)"
title="Width"
/>
<span class="size-separator">×</span>
<input
type="number"
id="grid-height-input"
min="1"
max="64"
value="8"
aria-label="Grid height (1-64)"
title="Height"
/>
<button class="btn btn-secondary" onclick="updateGridSize()" aria-label="Apply grid size">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polyline points="20 6 9 17 4 12"/>
</svg>
</button>
</div>
</div>
<!-- Orientation Selector -->
<div class="toolbar-group">
<label class="toolbar-label">Origin</label>
<div class="orientation-grid" role="radiogroup" aria-label="Grid origin position">
<button class="origin-btn active" data-orientation="top-left" onclick="updateOrientation('top-left')" aria-label="Origin top-left" title="Top Left">
<span class="origin-dot"></span>
</button>
<button class="origin-btn" data-orientation="top-right" onclick="updateOrientation('top-right')" aria-label="Origin top-right" title="Top Right">
<span class="origin-dot"></span>
</button>
<button class="origin-btn" data-orientation="bottom-left" onclick="updateOrientation('bottom-left')" aria-label="Origin bottom-left" title="Bottom Left">
<span class="origin-dot"></span>
</button>
<button class="origin-btn" data-orientation="bottom-right" onclick="updateOrientation('bottom-right')" aria-label="Origin bottom-right" title="Bottom Right">
<span class="origin-dot"></span>
</button>
</div>
</div>
<!-- Color Picker -->
<div class="toolbar-group">
<label class="toolbar-label" for="color-picker">Color</label>
<div class="color-picker-wrapper">
<input type="color" id="color-picker" value="#00f0ff" aria-label="LED color" />
<span class="color-preview" id="color-preview"></span>
</div>
</div>
<!-- Divider -->
<div class="toolbar-divider" aria-hidden="true"></div>
<!-- Frame Controls -->
<div class="toolbar-group frame-controls">
<button class="btn btn-icon" onclick="prevFrame()" aria-label="Previous frame" title="Previous Frame">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polyline points="15 18 9 12 15 6"/>
</svg>
</button>
<span class="frame-indicator" id="frame-indicator" aria-live="polite">Frame 1/1</span>
<button class="btn btn-icon" onclick="nextFrame()" aria-label="Next frame" title="Next Frame">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polyline points="9 18 15 12 9 6"/>
</svg>
</button>
<button class="btn btn-secondary" onclick="newFrame()" title="Add new frame">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="12" y1="5" x2="12" y2="19"/>
<line x1="5" y1="12" x2="19" y2="12"/>
</svg>
<span class="btn-label">New</span>
</button>
<button class="btn btn-secondary" onclick="duplicateFrame()" title="Duplicate current frame">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"/>
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>
</svg>
<span class="btn-label">Dupe</span>
</button>
<button class="btn btn-danger btn-icon" onclick="deleteFrame()" title="Delete current frame">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polyline points="3 6 5 6 21 6"/>
<path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/>
</svg>
</button>
</div>
<!-- Divider -->
<div class="toolbar-divider" aria-hidden="true"></div>
<!-- Animation Controls -->
<div class="toolbar-group">
<label class="toolbar-label" for="speed-input">Speed</label>
<div class="input-with-unit">
<input type="number" id="speed-input" value="200" min="50" max="2000" step="50" aria-label="Animation speed in milliseconds per step" onchange="updateAnimationSpeed()"/>
<span class="input-unit">ms</span>
</div>
<button class="btn btn-play" id="play-btn" onclick="toggleScroll()" aria-label="Play animation" title="Play/Stop">
<svg class="icon-play" width="18" height="18" viewBox="0 0 24 24" fill="currentColor">
<polygon points="5 3 19 12 5 21 5 3"/>
</svg>
<svg class="icon-stop" width="18" height="18" viewBox="0 0 24 24" fill="currentColor" style="display:none">
<rect x="6" y="4" width="4" height="16"/>
<rect x="14" y="4" width="4" height="16"/>
</svg>
</button>
</div>
<!-- Clear Button -->
<button class="btn btn-danger" onclick="clearClickedButtons()" title="Clear current frame">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="18" y1="6" x2="6" y2="18"/>
<line x1="6" y1="6" x2="18" y2="18"/>
</svg>
<span class="btn-label">Clear</span>
</button>
</nav>
<!-- Frame Thumbnails Bar -->
<div class="frames-bar" id="frames-bar">
<div class="frames-list" id="frames-list">
<!-- Frame thumbnails will be rendered here -->
</div>
</div>
<!-- Grid Canvas -->
<section class="grid-section" aria-label="LED Matrix Grid">
<div class="grid-wrapper" id="grid-wrapper">
<div class="grid-container" id="grid-container" role="grid" aria-label="LED pixel grid"></div>
</div>
<!-- Coordinates Display -->
<output class="coords-display" id="clicked-buttons" aria-live="polite" aria-label="Selected coordinates">
Click cells to select pixels
</output>
</section>
</main>
<!-- Mobile Bottom Bar / Export Actions -->
<footer class="app-footer">
<div class="export-group">
<button class="btn btn-export" onclick="triggerImport()" title="Import JSON file">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
<polyline points="17 8 12 3 7 8"/>
<line x1="12" y1="3" x2="12" y2="15"/>
</svg>
<span>Import</span>
</button>
<button class="btn btn-export" onclick="copyCoordinates()" title="Copy JSON to clipboard">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"/>
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>
</svg>
<span>Copy</span>
</button>
<button class="btn btn-export" onclick="downloadJSON()" title="Download as JSON file">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
<polyline points="7 10 12 15 17 10"/>
<line x1="12" y1="15" x2="12" y2="3"/>
</svg>
<span>JSON</span>
</button>
<button class="btn btn-export" onclick="downloadCSV()" title="Download as CSV file">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>
<polyline points="14 2 14 8 20 8"/>
</svg>
<span>CSV</span>
</button>
<button class="btn btn-export" onclick="downloadGIF()" title="Download animation as GIF">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="2" y="2" width="20" height="20" rx="2.18" ry="2.18"/>
<line x1="7" y1="2" x2="7" y2="22"/>
<line x1="17" y1="2" x2="17" y2="22"/>
<line x1="2" y1="12" x2="22" y2="12"/>
<line x1="2" y1="7" x2="7" y2="7"/>
<line x1="2" y1="17" x2="7" y2="17"/>
<line x1="17" y1="17" x2="22" y2="17"/>
<line x1="17" y1="7" x2="22" y2="7"/>
</svg>
<span>GIF</span>
</button>
<button class="btn btn-export" onclick="downloadRustFile()" title="Download Rust source file">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>
<polyline points="14 2 14 8 20 8"/>
<line x1="16" y1="13" x2="8" y2="13"/>
<line x1="16" y1="17" x2="8" y2="17"/>
</svg>
<span>Rust</span>
</button>
<button class="btn btn-finished btn-export" onclick="showFinishedModal()" title="View complete Rust code">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polyline points="20 6 9 17 4 12"/>
</svg>
<span>Finished</span>
</button>
</div>
</footer>
<!-- Hidden file input for import -->
<input type="file" id="import-input" accept=".json" style="display: none" onchange="handleImport(event)" />
<!-- Toast notification container -->
<div class="toast-container" id="toast-container" aria-live="assertive"></div>
<!-- Rust Code Modal -->
<div class="modal-overlay" id="rust-modal" hidden>
<div class="modal" role="dialog" aria-labelledby="modal-title" aria-modal="true">
<div class="modal-header">
<h2 id="modal-title">Rust Animation Code</h2>
<button class="btn btn-icon modal-close" onclick="closeRustModal()" aria-label="Close modal">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="18" y1="6" x2="6" y2="18"/>
<line x1="6" y1="6" x2="18" y2="18"/>
</svg>
</button>
</div>
<div class="modal-body">
<div class="modal-info">
<div class="modal-stats" id="modal-stats"></div>
<p>Copy this code into your Rust project. Use <code>NmScroll::delay_ms()</code> to get the animation speed.</p>
</div>
<div class="code-container">
<pre><code id="rust-code-output"></code></pre>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" onclick="copyRustCode()">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"/>
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>
</svg>
Copy Code
</button>
<button class="btn btn-primary" onclick="downloadRustFromModal()">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
<polyline points="7 10 12 15 17 10"/>
<line x1="12" y1="15" x2="12" y2="3"/>
</svg>
Download .rs File
</button>
</div>
</div>
</div>
<script src="lib.js"></script>
<script src="script.js"></script>
<script>
// Anyone who reaches the editor has seen the intro; mark them so the
// home page redirects them straight here next time.
try { localStorage.setItem('neomatrix-visited', '1'); } catch (e) { /* storage blocked */ }
</script>
</body>
</html>