|
7 | 7 | import Shop from './Shop.svelte'; |
8 | 8 | import Footer from './Footer.svelte'; |
9 | 9 |
|
10 | | - import model from '$lib/assets/keyring.obj?url'; |
| 10 | + import model from '$lib/assets/Construct Logo.3mf?url'; |
| 11 | + import modelImage from '$lib/assets/model.png'; |
11 | 12 |
|
12 | 13 | let { data } = $props(); |
13 | 14 |
|
14 | 15 | import * as THREE from 'three'; |
15 | | - import { OBJLoader } from 'three/examples/jsm/Addons.js'; |
| 16 | + import { ThreeMFLoader } from 'three/examples/jsm/Addons.js'; |
16 | 17 | import { OrbitControls } from 'three/examples/jsm/Addons.js'; |
17 | 18 | import { onMount } from 'svelte'; |
18 | 19 | import Head from '$lib/components/Head.svelte'; |
|
59 | 60 | controls.enablePan = false; |
60 | 61 | controls.dampingFactor = 0.1; |
61 | 62 | controls.enableDamping = true; |
62 | | - controls.autoRotate = true; |
| 63 | + controls.autoRotate = false; |
63 | 64 | controls.autoRotateSpeed = 2; |
64 | 65 | controls.update(); |
65 | 66 |
|
66 | 67 | // Lighting |
67 | | - const hemisphere = new THREE.HemisphereLight(0xffffff, 0xffffff, 1.1); |
| 68 | + const hemisphere = new THREE.HemisphereLight(0xffffff, 0xffffff, 4); |
68 | 69 | scene.add(hemisphere); |
69 | 70 |
|
70 | | - const directional = new THREE.DirectionalLight(0xffffff, 1.1); |
| 71 | + const directional = new THREE.DirectionalLight(0xffffff, 1); |
71 | 72 | directional.castShadow = true; |
72 | 73 | directional.shadow.mapSize.width = 2048; |
73 | 74 | directional.shadow.mapSize.height = 2048; |
74 | 75 | scene.add(directional); |
75 | 76 |
|
76 | | - const directional2 = new THREE.DirectionalLight(0xffffff, 1.1); |
| 77 | + const directional2 = new THREE.DirectionalLight(0xffffff, 1); |
77 | 78 | directional2.castShadow = true; |
78 | 79 | directional2.shadow.mapSize.width = 2048; |
79 | 80 | directional2.shadow.mapSize.height = 2048; |
|
92 | 93 | } |
93 | 94 | } |
94 | 95 |
|
95 | | - var meshMaterial = new THREE.MeshStandardMaterial({ |
96 | | - transparent: true, |
97 | | - opacity: 0.9, |
98 | | - color: 0xb2a090, |
99 | | - roughness: 0.5, |
100 | | - flatShading: false, |
101 | | - side: THREE.DoubleSide |
102 | | - }); |
| 96 | + // var meshMaterial = new THREE.MeshStandardMaterial({ |
| 97 | + // transparent: true, |
| 98 | + // opacity: 1, |
| 99 | + // color: 0xb2a090, |
| 100 | + // roughness: 0.5, |
| 101 | + // flatShading: false, |
| 102 | + // side: THREE.DoubleSide |
| 103 | + // }); |
103 | 104 |
|
104 | 105 | function parseObject(object: THREE.Group<THREE.Object3DEventMap>) { |
105 | 106 | object = object as THREE.Group<THREE.Object3DEventMap> & { children: THREE.Mesh[] }; |
106 | 107 |
|
107 | 108 | object.rotation.x = THREE.MathUtils.degToRad(-90); |
108 | | - object.rotation.z = THREE.MathUtils.degToRad(-25); |
| 109 | + // object.rotation.z = THREE.MathUtils.degToRad(-25); |
109 | 110 |
|
110 | 111 | const aabb = new THREE.Box3().setFromObject(object); |
111 | 112 | const center = aabb.getCenter(new THREE.Vector3()); |
|
121 | 122 | box.getSize(size); |
122 | 123 | const largestDimension = Math.max(size.x, size.y, size.z); |
123 | 124 |
|
124 | | - camera.position.z = largestDimension * 0.6; |
125 | | - camera.position.y = largestDimension * 1.4; |
| 125 | + camera.position.z = largestDimension * 0.3; |
| 126 | + camera.position.y = largestDimension * 1.38; |
126 | 127 |
|
127 | 128 | directional.position.set(largestDimension * 2, largestDimension * 2, largestDimension * 2); |
128 | 129 | directional2.position.set(-largestDimension * 2, largestDimension * 2, -largestDimension * 2); |
|
155 | 156 | // material.needsUpdate = true; |
156 | 157 | // } |
157 | 158 |
|
158 | | - if (Array.isArray(mesh.material)) { |
159 | | - mesh.material = meshMaterial; |
160 | | - } else if (mesh.material instanceof THREE.Material) { |
161 | | - mesh.material = meshMaterial; |
162 | | - } |
| 159 | + // if (Array.isArray(mesh.material)) { |
| 160 | + // mesh.material = meshMaterial; |
| 161 | + // } else if (mesh.material instanceof THREE.Material) { |
| 162 | + // mesh.material = meshMaterial; |
| 163 | + // } |
163 | 164 |
|
164 | 165 | const edges = new THREE.EdgesGeometry(mesh.geometry); |
165 | 166 | const lines = new THREE.LineSegments( |
|
187 | 188 | scene.add(object); |
188 | 189 | } |
189 | 190 |
|
190 | | - var loader = new OBJLoader(); |
| 191 | + var loader = new ThreeMFLoader(); |
191 | 192 |
|
192 | 193 | loader.load( |
193 | 194 | model, |
|
217 | 218 |
|
218 | 219 | <div class="flex w-full flex-col items-center justify-center px-10 lg:flex-row"> |
219 | 220 | <div class="mt-30"> |
220 | | - <div class="flex flex-row"> |
221 | | - <a class="mb-5 flex h-7 flex-row items-center gap-2 hover:opacity-50 transition-opacity shrink pr-2" href="https://hackclub.com"> |
| 221 | + <div class="relative z-1 flex flex-row"> |
| 222 | + <a |
| 223 | + class="mb-1 flex h-7 shrink flex-row items-center gap-2 pr-2 transition-opacity hover:opacity-50" |
| 224 | + href="https://hackclub.com" |
| 225 | + > |
222 | 226 | <img src="https://assets.hackclub.com/icon-rounded.svg" alt="Hack Club logo" class="h-7" /> |
223 | | - <p class="text-lg font-semibold"><span class="text-hc-red-500">Hack Club</span> presents...</p> |
| 227 | + <p class="text-lg font-semibold"> |
| 228 | + <span class="font-bold text-hc-red-500">Hack Club</span> presents... |
| 229 | + </p> |
224 | 230 | </a> |
225 | 231 | </div> |
226 | | - <h1 class="font-hero text-4xl text-primary-500 sm:text-5xl md:text-6xl">Construct</h1> |
227 | | - <p class="my-3 text-xl font-medium">Spend 50 hours doing CAD projects, get a 3D printer!</p> |
228 | | - {#if data.loggedIn} |
229 | | - <Button text="Go to dashboard" href="/dashboard" /> |
230 | | - {:else} |
231 | | - <Button text="Login with Hack Club" href="/auth/idv" /> |
232 | | - {/if} |
233 | | - <p class="text-md my-3">Ages 13-18, launching [TBD]!</p> |
234 | | - </div> |
235 | | - <div class="mt-12 flex h-100 w-80 flex-col md:w-100"> |
236 | | - <canvas class="h-full w-full" id={`canvas`}></canvas> |
237 | | - <p class="mt-2 w-full text-center text-sm">interact with me!</p> |
| 232 | + <div class="hidden sm:block"> |
| 233 | + <div |
| 234 | + class="group z-0 flex flex-col overflow-clip transition-all hover:h-130 sm:h-25 sm:w-150 md:h-30 md:w-160 lg:h-35 lg:w-200" |
| 235 | + > |
| 236 | + <canvas |
| 237 | + class="h-200 w-full transition-transform sm:translate-y-[-255px] sm:group-hover:-translate-y-15 md:translate-y-[-255px] md:group-hover:-translate-y-15 lg:translate-y-[-330px] lg:group-hover:-translate-y-35" |
| 238 | + width="200" |
| 239 | + height="200" |
| 240 | + id={`canvas`} |
| 241 | + ></canvas> |
| 242 | + </div> |
| 243 | + <p class="relative z-1 mt-2 w-full animate-pulse text-center text-sm">interact with me!</p> |
| 244 | + </div> |
| 245 | + <img src={modelImage} alt="construct model logo" class="mt-3 mb-6 sm:hidden" /> |
| 246 | + <div class="relative z-1 w-full text-center"> |
| 247 | + <p class="my-3 text-xl font-medium">Spend 50 hours doing CAD projects, get a 3D printer!</p> |
| 248 | + {#if data.loggedIn} |
| 249 | + <Button text="Go to dashboard" href="/dashboard" /> |
| 250 | + {:else} |
| 251 | + <Button text="Login with Hack Club" href="/auth/idv" /> |
| 252 | + {/if} |
| 253 | + <p class="text-md my-3">Ages 13-18, launching [TBD]!</p> |
| 254 | + </div> |
238 | 255 | </div> |
239 | 256 | </div> |
240 | 257 |
|
|
287 | 304 | </div> |
288 | 305 | </div> |
289 | 306 |
|
| 307 | +<div class="mt-15 mb-30 flex flex-col items-center justify-center gap-5 px-10"> |
| 308 | + <h1 class="text-center text-3xl font-bold sm:text-4xl">Ready?</h1> |
| 309 | + <div class="w-full max-w-2xl text-center"> |
| 310 | + {#if data.loggedIn} |
| 311 | + <Button text="Go to dashboard" href="/dashboard" /> |
| 312 | + {:else} |
| 313 | + <Button text="Login with Hack Club" href="/auth/idv" /> |
| 314 | + {/if} |
| 315 | + </div> |
| 316 | +</div> |
| 317 | + |
290 | 318 | <Footer /> |
0 commit comments