Create a full working web project (HTML, CSS, and JS in one) that perfectly replicates the intro animation of https://resn.co.nz. ✅ Required Features: 1. Fullscreen black canvas background. 2. Centered rotating 3D diamond object (glass-like appearance) using Three.js. - Reflective/refraction-like material or shader simulating gem look. - Slowly rotates by default. 3. When the user **clicks and holds** (or taps and holds on mobile), trigger the intro exit animation: - Diamond starts glowing, scaling, or shattering/dissolving. - Background fades or animates smoothly into a new state. - Transition ends by revealing simple content: e.g., a centered title like "Welcome to My Portfolio" with fade-in. 4. Use **Three.js** for 3D and **GSAP** for smooth animation/timing. 5. Fully responsive: Works on desktop and mobile (touch-compatible). 6. Include a preloader (e.g., loading bar or spinner) before showing the diamond. 7. Code everything in one file (`index.html`) including `<style>` and `<script>` blocks. 8. No external CMS or frameworks. Use CDN links only. 9. If a diamond model is needed, use a placeholder procedural shape (e.g., dodecahedron or custom geometry) if loading a `.glb` isn’t possible. 🔁 The goal is to **recreate exactly what Resn.co.nz does** on page load with full interactivity and animation. Output only the code (no explanations), in one single complete HTML file. - Initial Deployment
Browse files- README.md +6 -4
- index.html +283 -19
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
title: 9iw
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
title: 9iw
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: pink
|
| 5 |
+
colorTo: green
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,283 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Resn-style Intro</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
|
| 9 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.7.1/gsap.min.js"></script>
|
| 10 |
+
<style>
|
| 11 |
+
body {
|
| 12 |
+
margin: 0;
|
| 13 |
+
padding: 0;
|
| 14 |
+
overflow: hidden;
|
| 15 |
+
font-family: 'Inter', sans-serif;
|
| 16 |
+
-webkit-font-smoothing: antialiased;
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
#canvas {
|
| 20 |
+
position: fixed;
|
| 21 |
+
top: 0;
|
| 22 |
+
left: 0;
|
| 23 |
+
width: 100%;
|
| 24 |
+
height: 100%;
|
| 25 |
+
z-index: 1;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
#content {
|
| 29 |
+
position: absolute;
|
| 30 |
+
top: 0;
|
| 31 |
+
left: 0;
|
| 32 |
+
width: 100%;
|
| 33 |
+
height: 100%;
|
| 34 |
+
display: flex;
|
| 35 |
+
justify-content: center;
|
| 36 |
+
align-items: center;
|
| 37 |
+
z-index: 2;
|
| 38 |
+
opacity: 0;
|
| 39 |
+
pointer-events: none;
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
#preloader {
|
| 43 |
+
position: fixed;
|
| 44 |
+
top: 0;
|
| 45 |
+
left: 0;
|
| 46 |
+
width: 100%;
|
| 47 |
+
height: 100%;
|
| 48 |
+
background: #000;
|
| 49 |
+
display: flex;
|
| 50 |
+
justify-content: center;
|
| 51 |
+
align-items: center;
|
| 52 |
+
z-index: 10;
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
.loader {
|
| 56 |
+
width: 80px;
|
| 57 |
+
height: 80px;
|
| 58 |
+
border: 3px solid rgba(255, 255, 255, 0.2);
|
| 59 |
+
border-radius: 50%;
|
| 60 |
+
border-top-color: #fff;
|
| 61 |
+
animation: spin 1s ease-in-out infinite;
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
@keyframes spin {
|
| 65 |
+
to { transform: rotate(360deg); }
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
.progress-bar {
|
| 69 |
+
position: absolute;
|
| 70 |
+
bottom: 30%;
|
| 71 |
+
width: 200px;
|
| 72 |
+
height: 2px;
|
| 73 |
+
background: rgba(255, 255, 255, 0.2);
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
.progress {
|
| 77 |
+
height: 100%;
|
| 78 |
+
width: 0%;
|
| 79 |
+
background: white;
|
| 80 |
+
transition: width 0.1s;
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
.title {
|
| 84 |
+
color: white;
|
| 85 |
+
font-size: 3rem;
|
| 86 |
+
font-weight: 300;
|
| 87 |
+
letter-spacing: 2px;
|
| 88 |
+
text-transform: uppercase;
|
| 89 |
+
}
|
| 90 |
+
</style>
|
| 91 |
+
</head>
|
| 92 |
+
<body>
|
| 93 |
+
<div id="preloader">
|
| 94 |
+
<div class="loader"></div>
|
| 95 |
+
<div class="progress-bar">
|
| 96 |
+
<div class="progress"></div>
|
| 97 |
+
</div>
|
| 98 |
+
</div>
|
| 99 |
+
|
| 100 |
+
<div id="content">
|
| 101 |
+
<h1 class="title">Welcome to My Portfolio</h1>
|
| 102 |
+
</div>
|
| 103 |
+
|
| 104 |
+
<div id="canvas"></div>
|
| 105 |
+
|
| 106 |
+
<script>
|
| 107 |
+
// Preloader
|
| 108 |
+
const preloader = document.getElementById('preloader');
|
| 109 |
+
const progress = document.querySelector('.progress');
|
| 110 |
+
|
| 111 |
+
// Simulate loading
|
| 112 |
+
let progressValue = 0;
|
| 113 |
+
const loadingInterval = setInterval(() => {
|
| 114 |
+
progressValue += Math.random() * 10;
|
| 115 |
+
progress.style.width = `${progressValue}%`;
|
| 116 |
+
|
| 117 |
+
if (progressValue >= 100) {
|
| 118 |
+
clearInterval(loadingInterval);
|
| 119 |
+
gsap.to(preloader, {
|
| 120 |
+
opacity: 0,
|
| 121 |
+
duration: 0.5,
|
| 122 |
+
onComplete: () => {
|
| 123 |
+
preloader.style.display = 'none';
|
| 124 |
+
initThreeJS();
|
| 125 |
+
}
|
| 126 |
+
});
|
| 127 |
+
}
|
| 128 |
+
}, 100);
|
| 129 |
+
|
| 130 |
+
// Three.js setup
|
| 131 |
+
let scene, camera, renderer, diamond, clock, isAnimating = false;
|
| 132 |
+
|
| 133 |
+
function initThreeJS() {
|
| 134 |
+
// Scene
|
| 135 |
+
scene = new THREE.Scene();
|
| 136 |
+
scene.background = new THREE.Color(0x000000);
|
| 137 |
+
|
| 138 |
+
// Camera
|
| 139 |
+
camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
|
| 140 |
+
camera.position.z = 5;
|
| 141 |
+
|
| 142 |
+
// Renderer
|
| 143 |
+
renderer = new THREE.WebGLRenderer({ antialias: true });
|
| 144 |
+
renderer.setSize(window.innerWidth, window.innerHeight);
|
| 145 |
+
renderer.setPixelRatio(window.devicePixelRatio);
|
| 146 |
+
document.getElementById('canvas').appendChild(renderer.domElement);
|
| 147 |
+
|
| 148 |
+
// Clock for animations
|
| 149 |
+
clock = new THREE.Clock();
|
| 150 |
+
|
| 151 |
+
// Create diamond
|
| 152 |
+
createDiamond();
|
| 153 |
+
|
| 154 |
+
// Event listeners
|
| 155 |
+
window.addEventListener('resize', onWindowResize);
|
| 156 |
+
document.addEventListener('mousedown', startAnimation);
|
| 157 |
+
document.addEventListener('touchstart', startAnimation);
|
| 158 |
+
document.addEventListener('mouseup', stopAnimation);
|
| 159 |
+
document.addEventListener('touchend', stopAnimation);
|
| 160 |
+
|
| 161 |
+
// Start animation loop
|
| 162 |
+
animate();
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
function createDiamond() {
|
| 166 |
+
// Geometry - octahedron for diamond shape
|
| 167 |
+
const geometry = new THREE.OctahedronGeometry(1, 0);
|
| 168 |
+
|
| 169 |
+
// Material - glass-like appearance
|
| 170 |
+
const material = new THREE.MeshPhysicalMaterial({
|
| 171 |
+
color: 0xffffff,
|
| 172 |
+
transmission: 0.9,
|
| 173 |
+
roughness: 0.1,
|
| 174 |
+
metalness: 0.1,
|
| 175 |
+
clearcoat: 1,
|
| 176 |
+
clearcoatRoughness: 0.1,
|
| 177 |
+
ior: 2.3,
|
| 178 |
+
thickness: 1.5,
|
| 179 |
+
envMapIntensity: 1,
|
| 180 |
+
transparent: true,
|
| 181 |
+
opacity: 0.9
|
| 182 |
+
});
|
| 183 |
+
|
| 184 |
+
// Mesh
|
| 185 |
+
diamond = new THREE.Mesh(geometry, material);
|
| 186 |
+
scene.add(diamond);
|
| 187 |
+
|
| 188 |
+
// Add lights
|
| 189 |
+
const ambientLight = new THREE.AmbientLight(0x404040);
|
| 190 |
+
scene.add(ambientLight);
|
| 191 |
+
|
| 192 |
+
const directionalLight1 = new THREE.DirectionalLight(0xffffff, 1);
|
| 193 |
+
directionalLight1.position.set(1, 1, 1);
|
| 194 |
+
scene.add(directionalLight1);
|
| 195 |
+
|
| 196 |
+
const directionalLight2 = new THREE.DirectionalLight(0xffffff, 0.5);
|
| 197 |
+
directionalLight2.position.set(-1, -1, -1);
|
| 198 |
+
scene.add(directionalLight2);
|
| 199 |
+
|
| 200 |
+
// Add environment map for reflections
|
| 201 |
+
const envMap = new THREE.CubeTextureLoader()
|
| 202 |
+
.setPath('https://threejs.org/examples/textures/cube/pisa/')
|
| 203 |
+
.load(['px.png', 'nx.png', 'py.png', 'ny.png', 'pz.png', 'nz.png']);
|
| 204 |
+
|
| 205 |
+
envMap.mapping = THREE.CubeReflectionMapping;
|
| 206 |
+
scene.environment = envMap;
|
| 207 |
+
material.envMap = envMap;
|
| 208 |
+
}
|
| 209 |
+
|
| 210 |
+
function onWindowResize() {
|
| 211 |
+
camera.aspect = window.innerWidth / window.innerHeight;
|
| 212 |
+
camera.updateProjectionMatrix();
|
| 213 |
+
renderer.setSize(window.innerWidth, window.innerHeight);
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
+
function startAnimation(e) {
|
| 217 |
+
if (isAnimating) return;
|
| 218 |
+
|
| 219 |
+
// Prevent default for touch events
|
| 220 |
+
if (e.type === 'touchstart') {
|
| 221 |
+
e.preventDefault();
|
| 222 |
+
}
|
| 223 |
+
|
| 224 |
+
isAnimating = true;
|
| 225 |
+
|
| 226 |
+
// Diamond animation
|
| 227 |
+
gsap.to(diamond.scale, {
|
| 228 |
+
x: 1.5,
|
| 229 |
+
y: 1.5,
|
| 230 |
+
z: 1.5,
|
| 231 |
+
duration: 1.5,
|
| 232 |
+
ease: "power2.out"
|
| 233 |
+
});
|
| 234 |
+
|
| 235 |
+
gsap.to(diamond.material, {
|
| 236 |
+
opacity: 0,
|
| 237 |
+
duration: 1.5,
|
| 238 |
+
ease: "power2.out"
|
| 239 |
+
});
|
| 240 |
+
|
| 241 |
+
// Background fade
|
| 242 |
+
gsap.to(scene.background, {
|
| 243 |
+
r: 0.05,
|
| 244 |
+
g: 0.05,
|
| 245 |
+
b: 0.05,
|
| 246 |
+
duration: 1.5,
|
| 247 |
+
ease: "power2.out"
|
| 248 |
+
});
|
| 249 |
+
|
| 250 |
+
// Show content
|
| 251 |
+
gsap.to("#content", {
|
| 252 |
+
opacity: 1,
|
| 253 |
+
duration: 1,
|
| 254 |
+
delay: 0.5,
|
| 255 |
+
onComplete: () => {
|
| 256 |
+
// Remove event listeners after animation completes
|
| 257 |
+
document.removeEventListener('mousedown', startAnimation);
|
| 258 |
+
document.removeEventListener('touchstart', startAnimation);
|
| 259 |
+
}
|
| 260 |
+
});
|
| 261 |
+
}
|
| 262 |
+
|
| 263 |
+
function stopAnimation() {
|
| 264 |
+
if (!isAnimating) return;
|
| 265 |
+
isAnimating = false;
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
function animate() {
|
| 269 |
+
requestAnimationFrame(animate);
|
| 270 |
+
|
| 271 |
+
const delta = clock.getDelta();
|
| 272 |
+
|
| 273 |
+
if (!isAnimating) {
|
| 274 |
+
// Rotate diamond slowly when not animating
|
| 275 |
+
diamond.rotation.x += delta * 0.2;
|
| 276 |
+
diamond.rotation.y += delta * 0.3;
|
| 277 |
+
}
|
| 278 |
+
|
| 279 |
+
renderer.render(scene, camera);
|
| 280 |
+
}
|
| 281 |
+
</script>
|
| 282 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Demo1102/9iw" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 283 |
+
</html>
|