-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
487 lines (455 loc) · 17.5 KB
/
index.html
File metadata and controls
487 lines (455 loc) · 17.5 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
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Typexperiments</title>
<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=Inter:wght@400;500;600;700&display=swap" rel="stylesheet" />
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;1,400&display=swap" rel="stylesheet" />
<style>
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0a0a0a; }
canvas { display: block; width: 100%; height: 100%; position: absolute; top: 0; left: 0; }
canvas.hidden { display: none; }
/* Top bar */
.top-bar {
position: fixed;
top: 0; left: 0; right: 0;
height: 48px;
display: flex;
align-items: center;
padding: 0 24px;
z-index: 50;
font-family: 'Inter', system-ui, sans-serif;
pointer-events: none;
}
.site-title {
font-size: 14px;
font-weight: 700;
letter-spacing: -0.01em;
color: rgba(255,255,255,0.7);
user-select: none;
margin-right: 24px;
}
.nav-tabs {
display: flex;
gap: 4px;
pointer-events: all;
}
.nav-tab {
padding: 6px 14px;
border-radius: 8px;
border: none;
background: transparent;
color: rgba(255,255,255,0.35);
font-family: 'Inter', system-ui, sans-serif;
font-size: 12px;
font-weight: 500;
cursor: pointer;
transition: all 0.15s;
}
.nav-tab:hover { color: rgba(255,255,255,0.6); background: rgba(255,255,255,0.05); }
.nav-tab.active {
color: rgba(255,255,255,0.85);
background: rgba(255,255,255,0.08);
}
/* Credits — bottom left */
.credits {
position: fixed;
bottom: 20px;
left: 24px;
z-index: 50;
font-family: 'Inter', system-ui, sans-serif;
font-size: 11px;
line-height: 1.6;
color: rgba(255,255,255,0.35);
}
.credits a {
color: rgba(255,255,255,0.5);
text-decoration: none;
transition: color 0.15s;
}
.credits a:hover { color: rgba(255,255,255,0.8); }
/* Control Panel — top right */
.panel-toggle {
position: fixed;
top: 4px;
right: 20px;
width: 40px;
height: 40px;
border-radius: 10px;
border: 1px solid rgba(255,255,255,0.1);
background: rgba(20,20,20,0.8);
backdrop-filter: blur(12px);
color: #fff;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
z-index: 100;
transition: transform 0.2s, opacity 0.2s;
}
.panel-toggle:hover { background: rgba(40,40,40,0.95); transform: scale(1.05); }
.panel-toggle.hidden { opacity: 0; pointer-events: none; transform: scale(0.9); }
.control-panel {
position: fixed;
top: 52px;
right: 20px;
width: 300px;
max-height: calc(100vh - 72px);
overflow-y: auto;
border-radius: 14px;
border: 1px solid rgba(255,255,255,0.1);
background: rgba(14,14,14,0.92);
backdrop-filter: blur(20px);
color: #e0e0e0;
font-family: 'Inter', system-ui, sans-serif;
font-size: 12px;
z-index: 101;
transform: translateY(-8px) scale(0.97);
opacity: 0;
pointer-events: none;
transition: transform 0.25s cubic-bezier(0.16,1,0.3,1), opacity 0.2s;
}
.control-panel.open {
transform: translateY(0) scale(1);
opacity: 1;
pointer-events: all;
}
.panel-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 12px 14px 8px;
border-bottom: 1px solid rgba(255,255,255,0.06);
}
.panel-header h2 {
font-size: 12px;
font-weight: 600;
letter-spacing: 0.02em;
color: #fff;
}
.panel-close {
width: 26px; height: 26px;
border: none; background: rgba(255,255,255,0.06);
border-radius: 7px; color: #888; font-size: 15px;
cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.panel-close:hover { background: rgba(255,255,255,0.12); color: #fff; }
.panel-section {
padding: 10px 14px;
border-bottom: 1px solid rgba(255,255,255,0.04);
}
.panel-section:last-child { border-bottom: none; }
.section-title {
font-size: 10px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.08em;
color: #666;
margin-bottom: 8px;
}
.effect-grid {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
gap: 5px;
}
.effect-btn {
padding: 6px 0;
border-radius: 7px;
border: 1px solid rgba(255,255,255,0.08);
background: rgba(255,255,255,0.03);
color: #aaa;
font-family: 'Inter', system-ui, sans-serif;
font-size: 11px;
font-weight: 500;
cursor: pointer;
transition: all 0.15s;
}
.effect-btn:hover { background: rgba(255,255,255,0.08); color: #fff; }
.effect-btn.active {
background: rgba(255,255,255,0.12);
border-color: rgba(255,255,255,0.25);
color: #fff;
}
.slider-row {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 12px;
}
.slider-row:last-child { margin-bottom: 0; }
.slider-label { color: #888; font-size: 11px; min-width: 72px; }
.slider-value {
color: #666;
font-size: 10px;
font-variant-numeric: tabular-nums;
min-width: 32px;
text-align: right;
}
input[type="range"] {
-webkit-appearance: none;
appearance: none;
flex: 1;
height: 4px;
margin: 0 8px;
border-radius: 2px;
background: rgba(255,255,255,0.1);
outline: none;
}
input[type="range"]::-webkit-slider-thumb {
-webkit-appearance: none;
width: 14px; height: 14px;
border-radius: 50%;
background: #fff;
border: none;
cursor: pointer;
}
select {
width: 100%;
padding: 6px 24px 6px 8px;
border-radius: 7px;
border: 1px solid rgba(255,255,255,0.1);
background: rgba(255,255,255,0.05);
color: #ccc;
font-family: 'Inter', system-ui, sans-serif;
font-size: 11px;
outline: none;
cursor: pointer;
}
select:hover { border-color: rgba(255,255,255,0.2); }
textarea {
width: 100%;
height: 68px;
padding: 8px 10px;
border-radius: 7px;
border: 1px solid rgba(255,255,255,0.1);
background: rgba(255,255,255,0.04);
color: #ccc;
font-family: 'Inter', system-ui, sans-serif;
font-size: 11px;
line-height: 1.5;
resize: vertical;
outline: none;
}
textarea:focus { border-color: rgba(255,255,255,0.25); }
.btn-row { display: flex; gap: 5px; margin-top: 8px; }
.action-btn {
flex: 1;
padding: 7px 0;
border-radius: 7px;
border: 1px solid rgba(255,255,255,0.1);
background: rgba(255,255,255,0.06);
color: #ccc;
font-family: 'Inter', system-ui, sans-serif;
font-size: 11px;
font-weight: 500;
cursor: pointer;
transition: all 0.15s;
}
.action-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }
.action-btn.primary {
background: rgba(255,255,255,0.12);
border-color: rgba(255,255,255,0.2);
color: #fff;
}
.toggle-row {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 12px;
}
.toggle-row:last-child { margin-bottom: 0; }
.toggle-label { color: #888; font-size: 11px; }
.toggle-switch {
width: 36px; height: 20px;
border-radius: 10px;
border: none;
background: rgba(255,255,255,0.1);
cursor: pointer;
position: relative;
transition: background 0.15s;
}
.toggle-switch.on { background: rgba(255,180,60,0.5); }
.toggle-switch::after {
content: '';
position: absolute;
top: 2px; left: 2px;
width: 16px; height: 16px;
border-radius: 50%;
background: #fff;
transition: transform 0.15s;
}
.toggle-switch.on::after { transform: translateX(16px); }
/* Scrollbar */
.control-panel::-webkit-scrollbar { width: 4px; }
.control-panel::-webkit-scrollbar-track { background: transparent; }
.control-panel::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }
/* View panels — hidden by default via opacity/pointer-events, not display */
.control-panel[data-view] { }
.control-panel[data-view].wrong-view { display: none; }
</style>
</head>
<body>
<!-- Canvases -->
<canvas id="animCanvas"></canvas>
<canvas id="lavaCanvas" class="hidden"></canvas>
<!-- Top bar -->
<div class="top-bar">
<span class="site-title">Typexperiments</span>
<div class="nav-tabs">
<button class="nav-tab active" data-view="animations">Animations</button>
<button class="nav-tab" data-view="lava">Cursor is Lava</button>
</div>
</div>
<!-- Credits -->
<div class="credits">
Based on <a href="https://github.com/chenglou/pretext" target="_blank" rel="noopener">Pretext</a> by Cheng Lou<br />
Made by <a href="https://pablostanley.substack.com/" target="_blank" rel="noopener">Pablo Stanley</a> · <a href="https://github.com/pablostanley/typexperiments" target="_blank" rel="noopener">Clone it here</a>
</div>
<!-- Controls toggle -->
<button class="panel-toggle" id="panelToggle" title="Controls">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<line x1="4" y1="21" x2="4" y2="14"/><line x1="4" y1="10" x2="4" y2="3"/>
<line x1="12" y1="21" x2="12" y2="12"/><line x1="12" y1="8" x2="12" y2="3"/>
<line x1="20" y1="21" x2="20" y2="16"/><line x1="20" y1="12" x2="20" y2="3"/>
<line x1="1" y1="14" x2="7" y2="14"/><line x1="9" y1="8" x2="15" y2="8"/>
<line x1="17" y1="16" x2="23" y2="16"/>
</svg>
</button>
<!-- ============ ANIMATIONS PANEL ============ -->
<div class="control-panel" id="animPanel" data-view="animations">
<div class="panel-header">
<h2>Animations</h2>
<button class="panel-close" data-close>×</button>
</div>
<div class="panel-section">
<div class="section-title">Effect</div>
<div class="effect-grid" id="effectGrid">
<button class="effect-btn active" data-effect="morph">Morph</button>
<button class="effect-btn" data-effect="explode">Explode</button>
<button class="effect-btn" data-effect="pour">Pour</button>
<button class="effect-btn" data-effect="wave">Wave</button>
<button class="effect-btn" data-effect="typewriter">Type</button>
<button class="effect-btn" data-effect="vortex">Vortex</button>
</div>
</div>
<div class="panel-section">
<div class="section-title">Layout</div>
<div class="slider-row">
<span class="slider-label">Width</span>
<input type="range" id="widthSlider" min="100" max="1200" value="600" />
<span class="slider-value" id="widthValue">600</span>
</div>
<div class="slider-row">
<span class="slider-label">Font Size</span>
<input type="range" id="fontSizeSlider" min="14" max="72" value="32" />
<span class="slider-value" id="fontSizeValue">32</span>
</div>
<div class="slider-row">
<span class="slider-label">Line Height</span>
<input type="range" id="lineHeightSlider" min="100" max="250" value="150" />
<span class="slider-value" id="lineHeightValue">1.5</span>
</div>
</div>
<div class="panel-section">
<div class="section-title">Animation</div>
<div class="slider-row">
<span class="slider-label">Duration</span>
<input type="range" id="durationSlider" min="200" max="3000" value="1200" step="100" />
<span class="slider-value" id="durationValue">1.2s</span>
</div>
<div class="slider-row">
<span class="slider-label">Stagger</span>
<input type="range" id="staggerSlider" min="0" max="100" value="30" />
<span class="slider-value" id="staggerValue">30</span>
</div>
<div class="slider-row"><span class="slider-label">Easing</span></div>
<select id="easingSelect">
<option value="easeInOutCubic">Cubic (smooth)</option>
<option value="easeOutElastic">Elastic (bouncy)</option>
<option value="easeOutBounce">Bounce</option>
<option value="easeInOutQuad">Quad (gentle)</option>
<option value="linear">Linear</option>
</select>
</div>
<div class="panel-section" id="effectControls">
<div class="section-title">Effect Settings</div>
<div id="effectControlsInner"></div>
</div>
<div class="panel-section">
<div class="section-title">Text</div>
<textarea id="textInput">Words that explode, reassemble, flow like water. Since you know exact line breaks and widths at any container size, you can smoothly animate text between layouts — morphing from one column width to another, or having text pour into a shape.</textarea>
<div class="btn-row">
<button class="action-btn primary" id="playBtn">Play</button>
<button class="action-btn" id="resetBtn">Reset</button>
</div>
</div>
</div>
<!-- ============ LAVA PANEL ============ -->
<div class="control-panel wrong-view" id="lavaPanel" data-view="lava">
<div class="panel-header">
<h2>Cursor is Lava</h2>
<button class="panel-close" data-close>×</button>
</div>
<div class="panel-section">
<div class="section-title">Layout</div>
<select id="lavaLayout">
<option value="two-col">Two Columns</option>
<option value="three-col">Three Columns</option>
<option value="asymmetric">Asymmetric (Sidebar + Main)</option>
<option value="single">Single Column</option>
</select>
<div class="slider-row" style="margin-top:8px">
<span class="slider-label">Text Size</span>
<input type="range" id="lavaFontSize" min="10" max="32" value="16" />
<span class="slider-value" id="lavaFontSizeValue">16</span>
</div>
</div>
<div class="panel-section">
<div class="section-title">Cursor Effect</div>
<div class="slider-row">
<span class="slider-label">Radius</span>
<input type="range" id="lavaRadius" min="30" max="300" value="140" />
<span class="slider-value" id="lavaRadiusValue">140</span>
</div>
<div class="slider-row">
<span class="slider-label">Force</span>
<input type="range" id="lavaForce" min="10" max="300" value="150" />
<span class="slider-value" id="lavaForceValue">150</span>
</div>
<div class="slider-row">
<span class="slider-label">Spring</span>
<input type="range" id="lavaSpring" min="1" max="30" value="20" />
<span class="slider-value" id="lavaSpringValue">20</span>
</div>
<div class="slider-row">
<span class="slider-label">Damping</span>
<input type="range" id="lavaDamping" min="50" max="98" value="75" />
<span class="slider-value" id="lavaDampingValue">0.75</span>
</div>
</div>
<div class="panel-section">
<div class="section-title">Style</div>
<div class="toggle-row">
<span class="toggle-label">Heat tint</span>
<button class="toggle-switch" id="lavaHeatToggle"></button>
</div>
<div class="toggle-row">
<span class="toggle-label">Rotation</span>
<button class="toggle-switch on" id="lavaRotateToggle"></button>
</div>
</div>
<div class="panel-section">
<div class="section-title">Text</div>
<textarea id="lavaTextInput" style="height:100px">The art of typography is not merely the arrangement of letters on a page. It is the orchestration of space, rhythm, and meaning — a dance between form and content that has captivated craftspeople for centuries. Each letterform carries within it a history of human expression, from the carved inscriptions of ancient Rome to the digital typefaces that illuminate our screens today.
When we speak of typographic excellence, we speak of invisible design. The best typography disappears into the reading experience, carrying meaning without calling attention to itself. Yet within this invisibility lies extraordinary complexity: the precise kerning between letter pairs, the optical adjustments that make geometric forms appear balanced, the subtle variations in stroke weight that give a typeface its character.
Consider the space between words — not empty, but charged with potential. Too little and the text becomes a wall; too much and it fragments into isolated islands. The typographer navigates these waters with care, understanding that readability is not a luxury but a fundamental right of the reader. Every decision, from the choice of typeface to the width of margins, serves the ultimate goal of clear communication.
In the digital age, these principles have not diminished but evolved. The responsive nature of modern layouts demands a new fluency — text that adapts and reflows while maintaining its essential grace. This is where measurement meets art, where the precision of algorithms supports the intuition of design.</textarea>
</div>
</div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>