Changed around line 1
+ document.addEventListener('DOMContentLoaded', () => {
+ // Initialize 3D preview canvas
+ const canvas = document.getElementById('gamePreview');
+ const ctx = canvas.getContext('2d');
+
+ // Responsive canvas sizing
+ function resizeCanvas() {
+ const container = canvas.parentElement;
+ canvas.width = container.clientWidth;
+ canvas.height = container.clientHeight;
+ }
+
+ window.addEventListener('resize', resizeCanvas);
+ resizeCanvas();
+
+ // Simple 3D cube wireframe animation
+ let angle = 0;
+ const points = [
+ [-1, -1, -1],
+ [1, -1, -1],
+ [1, 1, -1],
+ [-1, 1, -1],
+ [-1, -1, 1],
+ [1, -1, 1],
+ [1, 1, 1],
+ [-1, 1, 1]
+ ];
+
+ function rotate3D(point, angle) {
+ const cos = Math.cos(angle);
+ const sin = Math.sin(angle);
+ return [
+ point[0] * cos - point[2] * sin,
+ point[1],
+ point[0] * sin + point[2] * cos
+ ];
+ }
+
+ function project(point) {
+ const scale = 100;
+ const z = 4;
+ return [
+ point[0] * scale / (z - point[2]) + canvas.width / 2,
+ point[1] * scale / (z - point[2]) + canvas.height / 2
+ ];
+ }
+
+ function animate() {
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
+ ctx.strokeStyle = '#6366f1';
+ ctx.beginPath();
+
+ const rotatedPoints = points.map(p => rotate3D(p, angle));
+ const projectedPoints = rotatedPoints.map(project);
+
+ // Draw edges
+ const edges = [
+ [0,1], [1,2], [2,3], [3,0],
+ [4,5], [5,6], [6,7], [7,4],
+ [0,4], [1,5], [2,6], [3,7]
+ ];
+
+ edges.forEach(([a, b]) => {
+ ctx.moveTo(projectedPoints[a][0], projectedPoints[a][1]);
+ ctx.lineTo(projectedPoints[b][0], projectedPoints[b][1]);
+ });
+
+ ctx.stroke();
+ angle += 0.02;
+ requestAnimationFrame(animate);
+ }
+
+ animate();
+
+ // Smooth scroll for navigation
+ document.querySelectorAll('a[href^="#"]').forEach(anchor => {
+ anchor.addEventListener('click', function (e) {
+ e.preventDefault();
+ document.querySelector(this.getAttribute('href')).scrollIntoView({
+ behavior: 'smooth'
+ });
+ });
+ });
+ });