-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
322 lines (272 loc) · 10.4 KB
/
index.html
File metadata and controls
322 lines (272 loc) · 10.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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0">
<title>Hanging It All Out to Dry | Fabrizio Guccione</title>
<link rel="stylesheet" href="css/style.css">
<style>
/* Inline critical styles for immediate render */
#loading {
position: fixed;
inset: 0;
z-index: 100;
background: #1a1a1a;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
color: white;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
#loading h1 {
font-size: 1.5rem;
font-weight: 300;
margin-bottom: 0.5rem;
}
#loading p {
font-size: 0.9rem;
opacity: 0.6;
}
</style>
</head>
<body>
<!-- Loading screen -->
<div id="loading">
<h1>Hanging it all out to dry...</h1>
<p>Loading textures</p>
</div>
<!-- Portfolio layer - revealed when all panels cleared -->
<div id="portfolio-layer">
<div class="portfolio-content">
<h1>Fabrizio Guccione</h1>
<p>
Creative Technologist exploring the intersection of fashion,
physical computing, and interactive experiences.
</p>
<a href="#" id="explore-btn">Explore My Work</a>
</div>
</div>
<!-- Cloth canvas layer -->
<div id="cloth-layer"></div>
<!-- Progress indicator -->
<div id="panel-indicator"></div>
<!-- Instructions -->
<div id="instructions">Click and drag to pull down the fabric</div>
<!-- Three.js -->
<script src="https://unpkg.com/three@0.139.2/build/three.min.js"></script>
<!-- Physics modules (Ten Minute Physics - SACRED) -->
<script src="js/vector-math.js"></script>
<script src="js/hash.js"></script>
<script src="js/cloth.js"></script>
<!-- App modules -->
<script src="js/grabber.js"></script>
<script src="js/cloth-manager.js"></script>
<script src="js/camera-controller.js"></script>
<script>
// ===== PANEL CONFIGURATION =====
// Each panel has a texture path and a fallback color (Google colors)
const PANEL_CONFIGS = [
{
id: 1,
texture: 'assets/panel-1.png',
color: 0x1a73e8, // Google Blue
title: 'The Confession',
description: 'I asked Gemini how to apply to this fellowship'
},
{
id: 2,
texture: 'assets/panel-2.png',
color: 0x34a853, // Google Green
title: 'The Vision',
description: 'Spoken dreams into wearable garments'
},
{
id: 3,
texture: 'assets/panel-3.png',
color: 0xea4335, // Google Red
title: 'The Proof',
description: 'It won a prize at MIT'
},
{
id: 4,
texture: 'assets/panel-4.png',
color: 0xfbbc04, // Google Yellow
title: 'The Future',
description: 'AI in your pocket, wrist, and clothes'
},
{
id: 5,
texture: 'assets/panel-5.png',
color: 0x4285f4, // Google Blue (light)
title: 'The Journey',
description: 'Italy, Singapore, New York'
},
{
id: 6,
texture: 'assets/panel-6.png',
color: 0x9334e6, // Purple
title: 'The Question',
description: 'What happens at a billion people?'
},
{
id: 7,
texture: 'assets/panel-7.png',
color: 0x202124, // Google Gray (dark)
title: 'The Reveal',
description: 'My deepest confession'
}
];
// ===== GLOBALS =====
var gThreeScene;
var gRenderer;
var gCamera;
var gGrabber;
var gClothManager;
var gCameraController;
var gTextureLoader;
var gSimulationStarted = false;
var gLastTime = 0;
// ===== INITIALIZATION =====
function init() {
var container = document.getElementById('cloth-layer');
// Scene
gThreeScene = new THREE.Scene();
// Texture loader
gTextureLoader = new THREE.TextureLoader();
// Renderer (transparent background)
gRenderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });
gRenderer.setClearColor(0x000000, 0);
gRenderer.setPixelRatio(window.devicePixelRatio);
gRenderer.setSize(window.innerWidth, window.innerHeight);
container.appendChild(gRenderer.domElement);
// Camera
var initialCameraZ = 2.5;
gCamera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.01, 100);
gCamera.position.set(0, 0, initialCameraZ);
gThreeScene.add(gCamera);
// Lighting
gThreeScene.add(new THREE.AmbientLight(0xffffff, 0.8));
var dirLight = new THREE.DirectionalLight(0xffffff, 0.4);
dirLight.position.set(0, 2, 2);
gThreeScene.add(dirLight);
// Camera Controller
gCameraController = new CameraController(gCamera, initialCameraZ);
// Cloth Manager
gClothManager = new ClothManager(gThreeScene, gCamera, PANEL_CONFIGS, gTextureLoader);
// Set up callbacks
gClothManager.onPanelCleared = function(index, config) {
console.log('Panel cleared:', index, config.title);
updateProgressIndicator();
};
gClothManager.onAllCleared = function() {
console.log('All panels cleared!');
showPortfolio();
};
// Create panels
gClothManager.createPanels();
// Grabber
gGrabber = new Grabber(gRenderer, gCamera);
// Create progress indicator
createProgressIndicator();
// Event listeners
container.addEventListener('pointerdown', onPointerDown);
container.addEventListener('pointermove', onPointerMove);
container.addEventListener('pointerup', onPointerUp);
window.addEventListener('resize', onWindowResize);
// Hide loading screen
setTimeout(function() {
document.getElementById('loading').classList.add('hidden');
}, 500);
// Start animation loop
gLastTime = performance.now();
animate();
}
// ===== PROGRESS INDICATOR =====
function createProgressIndicator() {
var indicator = document.getElementById('panel-indicator');
indicator.innerHTML = '';
for (var i = 0; i < PANEL_CONFIGS.length; i++) {
var dot = document.createElement('div');
dot.className = 'panel-dot' + (i === 0 ? ' active' : '');
dot.dataset.index = i;
indicator.appendChild(dot);
}
}
function updateProgressIndicator() {
var dots = document.querySelectorAll('.panel-dot');
var progress = gClothManager.getProgress();
dots.forEach(function(dot, i) {
dot.classList.remove('active', 'cleared');
if (i < progress.current) {
dot.classList.add('cleared');
} else if (i === progress.current) {
dot.classList.add('active');
}
});
// Hide instructions after first panel
if (progress.current > 0) {
document.getElementById('instructions').classList.add('hidden');
}
}
// ===== PORTFOLIO REVEAL =====
function showPortfolio() {
// Hide cloth layer
document.getElementById('cloth-layer').style.pointerEvents = 'none';
document.getElementById('panel-indicator').style.display = 'none';
// Portfolio is already visible behind - just make it interactive
document.getElementById('portfolio-layer').style.zIndex = '20';
}
// ===== EVENT HANDLERS =====
function onPointerDown(evt) {
evt.preventDefault();
// First click starts the simulation
if (!gSimulationStarted) {
gSimulationStarted = true;
gClothManager.start();
}
// Only interact with active cloth
var activeCloth = gClothManager.getActiveCloth();
gGrabber.start(evt.clientX, evt.clientY, activeCloth);
}
function onPointerMove(evt) {
evt.preventDefault();
gGrabber.move(evt.clientX, evt.clientY);
}
function onPointerUp(evt) {
evt.preventDefault();
gGrabber.end();
}
function onWindowResize() {
gCamera.aspect = window.innerWidth / window.innerHeight;
gCamera.updateProjectionMatrix();
gRenderer.setSize(window.innerWidth, window.innerHeight);
}
// ===== ANIMATION LOOP =====
function animate() {
requestAnimationFrame(animate);
var now = performance.now();
var dt = Math.min((now - gLastTime) / 1000, 0.033); // Cap at ~30fps
gLastTime = now;
// Update physics
gClothManager.update(dt);
// Update camera
gCameraController.update(dt);
// Update grabber time
gGrabber.increaseTime(dt);
// Check if active cloth has fallen
if (gSimulationStarted && gClothManager.checkFallComplete()) {
gClothManager.advanceToNext();
// Move camera forward
if (!gClothManager.isComplete()) {
gCameraController.moveForward(gClothManager.zSpacing);
}
}
// Render
gRenderer.render(gThreeScene, gCamera);
}
// ===== START =====
init();
</script>
</body>
</html>