# 3d-website

Three.js scene fixed behind normal HTML content with a scroll-driven camera tour (one stop per section), pointer parallax, capped pixel ratio, pause when hidden, static frame under reduced motion and a CSS fallback without WebGL. No build step (import map + CDN).

- **Space:** web-development-public (https://github.com/Tech-Realm/space-web-development-public/tree/main/3d-website)
- **Level:** L1 (as the registry reports it)
- **Keys it needs (names only):** none
- **Tools:** python3, playwright-python, chromium, network (jsdelivr CDN for three@0.170.0)
- **Routes:** static-local; checks: 1
- **Uses:** new (no recorded use yet)
- **Install:** `logicpacks pack use web-development-public/3d-website` or MCP `get_pack web-development-public/3d-website`
- **Files:** CHANGELOG.md, code/_shots/shot-1280-rm.png, code/_shots/shot-1280.png, code/_shots/shot-390-rm.png, code/_shots/shot-390.png, code/index.html, code/scene.js, code/style.css, outcome/EVIDENCE.md, outcome/checks.yaml, outcome/fixtures/steps.json, outcome/results.json, pack.yaml, refs/refs.yaml, spec/SPEC.md, spec/source.md

## Purpose (spec/SPEC.md)

## Goal
A marketing site where a real-time 3D object carries the story: as the visitor scrolls, the camera moves between stops that match each section. Text stays real HTML (SEO, accessibility), the page stays fast on phones, and nothing breaks without WebGL.

## Steps
1. Copy `code/` (index.html, style.css, scene.js). Keep the import map; pin the three version (`three@0.170.0`). For production either keep the CDN or `npm i three` and bundle.
2. Replace the knot with your model: `GLTFLoader` from `three/addons/loaders/GLTFLoader.js` (add `"three/addons/": ".../examples/jsm/"` to the import map). Compress with `gltf-transform optimize in.glb out.glb --compress draco --texture-compress webp`; keep it under ~2 MB.
3. Give each content section a `data-step` and define one camera stop per step (`pos`, `look`, `rotY`). The scroll handler only sets targets; the render loop eases toward them with frame-rate independent damping.
4. Phone framing: below 700 px push the camera back and lower the object so it sits behind or under the text.
5. Performance guards: `setPixelRatio(min(dpr, 1.75))`, pause the loop on `visibilitychange`, render a single frame on scroll when the loop is stopped (reduced motion).
6. Fallback: no WebGL or a lost context sets `html[data-webgl="off"]` and shows the CSS gradient layer.
7. Run the outcome checks (needs network for the CDN).

## Edge cases
- iOS low-power mode throttles rAF to 30 fps: damping is time-based, so motion stays correct.
- Huge GLB on mobile data: show the poster/fallback first and load the model after `load` or on interaction.
- Text contrast over the object: soft text-shadow on phones, or a translucent plate.
- WebGL context loss (tab in background for long): handled; consider re-init on `webglcontextrestored`.

## Don'ts
- Never put headings or copy inside the canvas.
- Do not run postprocessing (bloom, SSAO) on phones by default.
- Do not create geometries or materials inside the render loop.



---

Canonical URL: https://logicpacks.io/packs/web-development-public/3d-website

Developed by TechRealm (techrealm.online), the software team. Operated by Al Jash Trading (Establishment), Abu Dhabi, since 1994, the legal entity that hosts and is responsible for the service. Economic licence CN-1030597, Abu Dhabi Registration Authority. Address: Office 5, Bani Yas West 4, Bani Yas, Abu Dhabi, UAE. Website: https://aljashtrading.com. Contact: hello@logicpacks.io, security@logicpacks.io, WhatsApp +1 713 632 2262 (https://wa.me/17136322262).

Machine-readable index: [/llms.txt](/llms.txt). Plain facts: [/about.md](/about.md). Safety: [/safety.md](/safety.md).
