|
52 | 52 | } |
53 | 53 | </style> |
54 | 54 | <link rel="stylesheet" href="/styles/lazy-styles.css"> |
| 55 | + <script nonce="aem" src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script> |
| 56 | + <style> |
| 57 | + #three-container { |
| 58 | + position: fixed; |
| 59 | + top: 0; |
| 60 | + left: 0; |
| 61 | + width: 100%; |
| 62 | + height: 100%; |
| 63 | + z-index: -1; |
| 64 | + pointer-events: none; |
| 65 | + } |
| 66 | + </style> |
55 | 67 | </head> |
56 | 68 |
|
57 | 69 | <body> |
58 | 70 | <header></header> |
| 71 | + <div id="three-container"></div> |
59 | 72 | <main class="error"> |
60 | 73 | <div class="section"> |
61 | 74 | <svg viewBox="1 0 38 18" class="error-number"> |
62 | 75 | <text x="0" y="17">404</text> |
63 | 76 | </svg> |
64 | | - <h2 class="error-message">Page Not Found</h2> |
| 77 | + <h2 class="error-message">Page Not Found!</h2> |
65 | 78 | <p class="button-container"> |
66 | 79 | <a href="/" class="button secondary error-button-home">Go home</a> |
67 | 80 | </p> |
68 | 81 | </div> |
69 | 82 | </main> |
70 | 83 | <footer></footer> |
| 84 | + <script nonce="aem"> |
| 85 | + (function() { |
| 86 | + const container = document.getElementById('three-container'); |
| 87 | + const scene = new THREE.Scene(); |
| 88 | + const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000); |
| 89 | + const renderer = new THREE.WebGLRenderer({ alpha: true, antialias: true }); |
| 90 | + |
| 91 | + renderer.setSize(window.innerWidth, window.innerHeight); |
| 92 | + renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2)); |
| 93 | + container.appendChild(renderer.domElement); |
| 94 | + |
| 95 | + const shapes = []; |
| 96 | + const geometries = [ |
| 97 | + new THREE.TetrahedronGeometry(0.5), |
| 98 | + new THREE.OctahedronGeometry(0.4), |
| 99 | + new THREE.IcosahedronGeometry(0.35), |
| 100 | + new THREE.TorusGeometry(0.3, 0.1, 8, 16) |
| 101 | + ]; |
| 102 | + |
| 103 | + for (let i = 0; i < 20; i++) { |
| 104 | + const geometry = geometries[Math.floor(Math.random() * geometries.length)]; |
| 105 | + const material = new THREE.MeshBasicMaterial({ |
| 106 | + color: new THREE.Color().setHSL(Math.random() * 0.2 + 0.55, 0.7, 0.6), |
| 107 | + wireframe: true, |
| 108 | + transparent: true, |
| 109 | + opacity: 0.6 |
| 110 | + }); |
| 111 | + const mesh = new THREE.Mesh(geometry, material); |
| 112 | + |
| 113 | + mesh.position.set( |
| 114 | + (Math.random() - 0.5) * 15, |
| 115 | + (Math.random() - 0.5) * 10, |
| 116 | + (Math.random() - 0.5) * 10 - 5 |
| 117 | + ); |
| 118 | + mesh.rotation.set( |
| 119 | + Math.random() * Math.PI, |
| 120 | + Math.random() * Math.PI, |
| 121 | + Math.random() * Math.PI |
| 122 | + ); |
| 123 | + mesh.userData = { |
| 124 | + rotationSpeed: { |
| 125 | + x: (Math.random() - 0.5) * 0.02, |
| 126 | + y: (Math.random() - 0.5) * 0.02, |
| 127 | + z: (Math.random() - 0.5) * 0.02 |
| 128 | + }, |
| 129 | + floatSpeed: Math.random() * 0.5 + 0.5, |
| 130 | + floatOffset: Math.random() * Math.PI * 2 |
| 131 | + }; |
| 132 | + |
| 133 | + shapes.push(mesh); |
| 134 | + scene.add(mesh); |
| 135 | + } |
| 136 | + |
| 137 | + camera.position.z = 5; |
| 138 | + |
| 139 | + function animate(time) { |
| 140 | + requestAnimationFrame(animate); |
| 141 | + |
| 142 | + shapes.forEach((shape) => { |
| 143 | + shape.rotation.x += shape.userData.rotationSpeed.x; |
| 144 | + shape.rotation.y += shape.userData.rotationSpeed.y; |
| 145 | + shape.rotation.z += shape.userData.rotationSpeed.z; |
| 146 | + shape.position.y += Math.sin(time * 0.001 * shape.userData.floatSpeed + shape.userData.floatOffset) * 0.002; |
| 147 | + }); |
| 148 | + |
| 149 | + renderer.render(scene, camera); |
| 150 | + } |
| 151 | + |
| 152 | + window.addEventListener('resize', () => { |
| 153 | + camera.aspect = window.innerWidth / window.innerHeight; |
| 154 | + camera.updateProjectionMatrix(); |
| 155 | + renderer.setSize(window.innerWidth, window.innerHeight); |
| 156 | + }); |
| 157 | + |
| 158 | + animate(0); |
| 159 | + })(); |
| 160 | + </script> |
71 | 161 | </body> |
72 | 162 |
|
73 | 163 | </html> |
0 commit comments