Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1b166292a9 |
@ -1,302 +1,77 @@
|
|||||||
body {
|
:root {
|
||||||
background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
|
--primary: #39FF14;
|
||||||
background-size: 400% 400%;
|
--bg: #050505;
|
||||||
animation: gradient 15s ease infinite;
|
--text: #ffffff;
|
||||||
color: #212529;
|
|
||||||
font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
|
||||||
font-size: 14px;
|
|
||||||
margin: 0;
|
|
||||||
min-height: 100vh;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.main-wrapper {
|
body, html, #root {
|
||||||
display: flex;
|
margin: 0;
|
||||||
align-items: center;
|
padding: 0;
|
||||||
justify-content: center;
|
width: 100%;
|
||||||
min-height: 100vh;
|
height: 100%;
|
||||||
width: 100%;
|
overflow: hidden;
|
||||||
padding: 20px;
|
background-color: var(--bg);
|
||||||
box-sizing: border-box;
|
font-family: 'Inter', system-ui, -apple-system, sans-serif;
|
||||||
position: relative;
|
color: var(--text);
|
||||||
z-index: 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes gradient {
|
#ui-layer {
|
||||||
0% {
|
position: absolute;
|
||||||
background-position: 0% 50%;
|
top: 0;
|
||||||
}
|
left: 0;
|
||||||
50% {
|
width: 100%;
|
||||||
background-position: 100% 50%;
|
height: 100%;
|
||||||
}
|
pointer-events: none;
|
||||||
100% {
|
display: flex;
|
||||||
background-position: 0% 50%;
|
flex-direction: column;
|
||||||
}
|
justify-content: flex-end;
|
||||||
|
padding: 40px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
z-index: 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-container {
|
.speed-indicator {
|
||||||
width: 100%;
|
display: flex;
|
||||||
max-width: 600px;
|
flex-direction: column;
|
||||||
background: rgba(255, 255, 255, 0.85);
|
gap: 8px;
|
||||||
border: 1px solid rgba(255, 255, 255, 0.3);
|
width: 200px;
|
||||||
border-radius: 20px;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
height: 85vh;
|
|
||||||
box-shadow: 0 20px 40px rgba(0,0,0,0.2);
|
|
||||||
backdrop-filter: blur(15px);
|
|
||||||
-webkit-backdrop-filter: blur(15px);
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-header {
|
.speed-label {
|
||||||
padding: 1.5rem;
|
font-size: 12px;
|
||||||
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
|
text-transform: uppercase;
|
||||||
background: rgba(255, 255, 255, 0.5);
|
letter-spacing: 2px;
|
||||||
font-weight: 700;
|
opacity: 0.6;
|
||||||
font-size: 1.1rem;
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-messages {
|
.speed-bar-container {
|
||||||
flex: 1;
|
height: 4px;
|
||||||
overflow-y: auto;
|
background: rgba(255, 255, 255, 0.1);
|
||||||
padding: 1.5rem;
|
border-radius: 2px;
|
||||||
display: flex;
|
overflow: hidden;
|
||||||
flex-direction: column;
|
|
||||||
gap: 1.25rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Custom Scrollbar */
|
.speed-bar {
|
||||||
::-webkit-scrollbar {
|
height: 100%;
|
||||||
width: 6px;
|
background: var(--primary);
|
||||||
|
width: 0%;
|
||||||
|
transition: width 0.1s ease-out;
|
||||||
|
box-shadow: 0 0 10px var(--primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
::-webkit-scrollbar-track {
|
.instructions {
|
||||||
background: transparent;
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
text-align: center;
|
||||||
|
opacity: 0.4;
|
||||||
|
font-weight: 300;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
pointer-events: none;
|
||||||
|
transition: opacity 1s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
::-webkit-scrollbar-thumb {
|
.instructions.hidden {
|
||||||
background: rgba(255, 255, 255, 0.3);
|
opacity: 0;
|
||||||
border-radius: 10px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
::-webkit-scrollbar-thumb:hover {
|
|
||||||
background: rgba(255, 255, 255, 0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
.message {
|
|
||||||
max-width: 85%;
|
|
||||||
padding: 0.85rem 1.1rem;
|
|
||||||
border-radius: 16px;
|
|
||||||
line-height: 1.5;
|
|
||||||
font-size: 0.95rem;
|
|
||||||
box-shadow: 0 4px 15px rgba(0,0,0,0.05);
|
|
||||||
animation: fadeIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes fadeIn {
|
|
||||||
from { opacity: 0; transform: translateY(20px) scale(0.95); }
|
|
||||||
to { opacity: 1; transform: translateY(0) scale(1); }
|
|
||||||
}
|
|
||||||
|
|
||||||
.message.visitor {
|
|
||||||
align-self: flex-end;
|
|
||||||
background: linear-gradient(135deg, #212529 0%, #343a40 100%);
|
|
||||||
color: #fff;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.message.bot {
|
|
||||||
align-self: flex-start;
|
|
||||||
background: #ffffff;
|
|
||||||
color: #212529;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chat-input-area {
|
|
||||||
padding: 1.25rem;
|
|
||||||
background: rgba(255, 255, 255, 0.5);
|
|
||||||
border-top: 1px solid rgba(0, 0, 0, 0.05);
|
|
||||||
}
|
|
||||||
|
|
||||||
.chat-input-area form {
|
|
||||||
display: flex;
|
|
||||||
gap: 0.75rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chat-input-area input {
|
|
||||||
flex: 1;
|
|
||||||
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
||||||
border-radius: 12px;
|
|
||||||
padding: 0.75rem 1rem;
|
|
||||||
outline: none;
|
|
||||||
background: rgba(255, 255, 255, 0.9);
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chat-input-area input:focus {
|
|
||||||
border-color: #23a6d5;
|
|
||||||
box-shadow: 0 0 0 3px rgba(35, 166, 213, 0.2);
|
|
||||||
}
|
|
||||||
|
|
||||||
.chat-input-area button {
|
|
||||||
background: #212529;
|
|
||||||
color: #fff;
|
|
||||||
border: none;
|
|
||||||
padding: 0.75rem 1.5rem;
|
|
||||||
border-radius: 12px;
|
|
||||||
cursor: pointer;
|
|
||||||
font-weight: 600;
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chat-input-area button:hover {
|
|
||||||
background: #000;
|
|
||||||
transform: translateY(-2px);
|
|
||||||
box-shadow: 0 5px 15px rgba(0,0,0,0.2);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Background Animations */
|
|
||||||
.bg-animations {
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
z-index: 0;
|
|
||||||
overflow: hidden;
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.blob {
|
|
||||||
position: absolute;
|
|
||||||
width: 500px;
|
|
||||||
height: 500px;
|
|
||||||
background: rgba(255, 255, 255, 0.2);
|
|
||||||
border-radius: 50%;
|
|
||||||
filter: blur(80px);
|
|
||||||
animation: move 20s infinite alternate cubic-bezier(0.45, 0, 0.55, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.blob-1 {
|
|
||||||
top: -10%;
|
|
||||||
left: -10%;
|
|
||||||
background: rgba(238, 119, 82, 0.4);
|
|
||||||
}
|
|
||||||
|
|
||||||
.blob-2 {
|
|
||||||
bottom: -10%;
|
|
||||||
right: -10%;
|
|
||||||
background: rgba(35, 166, 213, 0.4);
|
|
||||||
animation-delay: -7s;
|
|
||||||
width: 600px;
|
|
||||||
height: 600px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.blob-3 {
|
|
||||||
top: 40%;
|
|
||||||
left: 30%;
|
|
||||||
background: rgba(231, 60, 126, 0.3);
|
|
||||||
animation-delay: -14s;
|
|
||||||
width: 450px;
|
|
||||||
height: 450px;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes move {
|
|
||||||
0% { transform: translate(0, 0) rotate(0deg) scale(1); }
|
|
||||||
33% { transform: translate(150px, 100px) rotate(120deg) scale(1.1); }
|
|
||||||
66% { transform: translate(-50px, 200px) rotate(240deg) scale(0.9); }
|
|
||||||
100% { transform: translate(0, 0) rotate(360deg) scale(1); }
|
|
||||||
}
|
|
||||||
|
|
||||||
.admin-link {
|
|
||||||
font-size: 14px;
|
|
||||||
color: #fff;
|
|
||||||
text-decoration: none;
|
|
||||||
background: rgba(0, 0, 0, 0.2);
|
|
||||||
padding: 0.5rem 1rem;
|
|
||||||
border-radius: 8px;
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.admin-link:hover {
|
|
||||||
background: rgba(0, 0, 0, 0.4);
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Admin Styles */
|
|
||||||
.admin-container {
|
|
||||||
max-width: 900px;
|
|
||||||
margin: 3rem auto;
|
|
||||||
padding: 2.5rem;
|
|
||||||
background: rgba(255, 255, 255, 0.85);
|
|
||||||
backdrop-filter: blur(20px);
|
|
||||||
-webkit-backdrop-filter: blur(20px);
|
|
||||||
border-radius: 24px;
|
|
||||||
box-shadow: 0 20px 50px rgba(0,0,0,0.15);
|
|
||||||
border: 1px solid rgba(255, 255, 255, 0.4);
|
|
||||||
position: relative;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.admin-container h1 {
|
|
||||||
margin-top: 0;
|
|
||||||
color: #212529;
|
|
||||||
font-weight: 800;
|
|
||||||
}
|
|
||||||
|
|
||||||
.table {
|
|
||||||
width: 100%;
|
|
||||||
border-collapse: separate;
|
|
||||||
border-spacing: 0 8px;
|
|
||||||
margin-top: 1.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.table th {
|
|
||||||
background: transparent;
|
|
||||||
border: none;
|
|
||||||
padding: 1rem;
|
|
||||||
color: #6c757d;
|
|
||||||
font-weight: 600;
|
|
||||||
text-transform: uppercase;
|
|
||||||
font-size: 0.75rem;
|
|
||||||
letter-spacing: 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.table td {
|
|
||||||
background: #fff;
|
|
||||||
padding: 1rem;
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.table tr td:first-child { border-radius: 12px 0 0 12px; }
|
|
||||||
.table tr td:last-child { border-radius: 0 12px 12px 0; }
|
|
||||||
|
|
||||||
.form-group {
|
|
||||||
margin-bottom: 1.25rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-group label {
|
|
||||||
display: block;
|
|
||||||
margin-bottom: 0.5rem;
|
|
||||||
font-weight: 600;
|
|
||||||
font-size: 0.9rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-control {
|
|
||||||
width: 100%;
|
|
||||||
padding: 0.75rem 1rem;
|
|
||||||
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
||||||
border-radius: 12px;
|
|
||||||
background: #fff;
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-control:focus {
|
|
||||||
outline: none;
|
|
||||||
border-color: #23a6d5;
|
|
||||||
box-shadow: 0 0 0 3px rgba(35, 166, 213, 0.1);
|
|
||||||
}
|
|
||||||
222
assets/js/game.js
Normal file
222
assets/js/game.js
Normal file
@ -0,0 +1,222 @@
|
|||||||
|
import React, { useState, useEffect, useRef, useMemo, Suspense } from 'https://esm.sh/react';
|
||||||
|
import ReactDOM from 'https://esm.sh/react-dom/client';
|
||||||
|
import * as THREE from 'https://esm.sh/three';
|
||||||
|
import { Canvas, useFrame, useThree } from 'https://esm.sh/@react-three/fiber';
|
||||||
|
import { useGLTF, useAnimations, PerspectiveCamera, Environment, Stars, Float } from 'https://esm.sh/@react-three/drei';
|
||||||
|
|
||||||
|
const MODEL_URL = 'https://raw.githubusercontent.com/mrdoob/three.js/master/examples/models/gltf/Horse.glb';
|
||||||
|
|
||||||
|
function Animal({ velocity }) {
|
||||||
|
const group = useRef();
|
||||||
|
const { scene, animations } = useGLTF(MODEL_URL);
|
||||||
|
const { actions } = useAnimations(animations, group);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
// Horse model usually has an animation named 'run' or the first one is the run loop
|
||||||
|
const animationName = animations[0]?.name;
|
||||||
|
if (actions[animationName]) {
|
||||||
|
actions[animationName].play();
|
||||||
|
}
|
||||||
|
return () => actions[animationName]?.stop();
|
||||||
|
}, [actions, animations]);
|
||||||
|
|
||||||
|
useFrame((state, delta) => {
|
||||||
|
const animationName = animations[0]?.name;
|
||||||
|
if (actions[animationName]) {
|
||||||
|
const animScale = 0.2 + (velocity * 3.5);
|
||||||
|
actions[animationName].setEffectiveTimeScale(animScale);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (group.current) {
|
||||||
|
group.current.rotation.z = THREE.MathUtils.lerp(group.current.rotation.z, (velocity * 0.1), 0.1);
|
||||||
|
group.current.position.y = Math.sin(state.clock.elapsedTime * 15 * velocity) * 0.1 * velocity;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<group ref={group} dispose={null} scale={[0.012, 0.012, 0.012]} position={[0, 0, 0]}>
|
||||||
|
<primitive object={scene} rotation={[0, Math.PI, 0]} />
|
||||||
|
</group>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function InfiniteGround({ velocity }) {
|
||||||
|
const meshRef = useRef();
|
||||||
|
const texture = useMemo(() => {
|
||||||
|
const canvas = document.createElement('canvas');
|
||||||
|
canvas.width = 512;
|
||||||
|
canvas.height = 512;
|
||||||
|
const ctx = canvas.getContext('2d');
|
||||||
|
ctx.fillStyle = '#050505';
|
||||||
|
ctx.fillRect(0, 0, 512, 512);
|
||||||
|
ctx.strokeStyle = '#39FF1444';
|
||||||
|
ctx.lineWidth = 1;
|
||||||
|
ctx.strokeRect(0, 0, 512, 512);
|
||||||
|
const tex = new THREE.CanvasTexture(canvas);
|
||||||
|
tex.wrapS = tex.wrapT = THREE.RepeatWrapping;
|
||||||
|
tex.repeat.set(100, 100);
|
||||||
|
return tex;
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
useFrame((state, delta) => {
|
||||||
|
const speed = velocity * 25 * delta;
|
||||||
|
meshRef.current.material.map.offset.y += speed;
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<mesh ref={meshRef} rotation={[-Math.PI / 2, 0, 0]} position={[0, -0.01, 0]} receiveShadow>
|
||||||
|
<planeGeometry args={[1000, 1000]} />
|
||||||
|
<meshStandardMaterial map={texture} roughness={0.8} metalness={0.2} />
|
||||||
|
</mesh>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function Trees({ velocity }) {
|
||||||
|
const count = 40;
|
||||||
|
const trees = useMemo(() => {
|
||||||
|
const arr = [];
|
||||||
|
for (let i = 0; i < count; i++) {
|
||||||
|
arr.push({
|
||||||
|
id: i,
|
||||||
|
position: [
|
||||||
|
(Math.random() - 0.5) * 60 + (Math.random() > 0.5 ? 15 : -15),
|
||||||
|
0,
|
||||||
|
-Math.random() * 200
|
||||||
|
],
|
||||||
|
scale: 0.5 + Math.random() * 2
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return arr;
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const groupRef = useRef();
|
||||||
|
|
||||||
|
useFrame((state, delta) => {
|
||||||
|
const speed = velocity * 25 * delta;
|
||||||
|
groupRef.current.children.forEach((child) => {
|
||||||
|
child.position.z += speed;
|
||||||
|
if (child.position.z > 20) {
|
||||||
|
child.position.z = -180;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<group ref={groupRef}>
|
||||||
|
{trees.map((tree) => (
|
||||||
|
<group key={tree.id} position={tree.position} scale={tree.scale}>
|
||||||
|
<mesh position={[0, 1.5, 0]} castShadow>
|
||||||
|
<coneGeometry args={[0.5, 3, 8]} />
|
||||||
|
<meshStandardMaterial color="#1a2e1a" />
|
||||||
|
</mesh>
|
||||||
|
<mesh position={[0, 0.2, 0]} castShadow>
|
||||||
|
<cylinderGeometry args={[0.15, 0.15, 0.5, 8]} />
|
||||||
|
<meshStandardMaterial color="#3d2b1f" />
|
||||||
|
</mesh>
|
||||||
|
</group>
|
||||||
|
))}
|
||||||
|
</group>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function GameScene({ velocity }) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<color attach="background" args={['#050505']} />
|
||||||
|
<fog attach="fog" args={['#050505', 10, 150]} />
|
||||||
|
|
||||||
|
<PerspectiveCamera makeDefault position={[0, 2, 6]} fov={50} />
|
||||||
|
|
||||||
|
<ambientLight intensity={0.5} />
|
||||||
|
<directionalLight
|
||||||
|
position={[10, 10, 5]}
|
||||||
|
intensity={1}
|
||||||
|
castShadow
|
||||||
|
shadow-mapSize-width={1024}
|
||||||
|
shadow-mapSize-height={1024}
|
||||||
|
/>
|
||||||
|
<pointLight position={[-10, 5, -10]} intensity={0.5} color="#44aaff" />
|
||||||
|
|
||||||
|
<Suspense fallback={null}>
|
||||||
|
<Animal velocity={velocity} />
|
||||||
|
<Trees velocity={velocity} />
|
||||||
|
<InfiniteGround velocity={velocity} />
|
||||||
|
<Environment preset="city" />
|
||||||
|
</Suspense>
|
||||||
|
|
||||||
|
<Stars radius={100} depth={50} count={5000} factor={4} saturation={0} fade speed={1} />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function GameBridge({ onUpdate, onStart }) {
|
||||||
|
const targetVelocity = useRef(0);
|
||||||
|
const velocity = useRef(0);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const handleScroll = (e) => {
|
||||||
|
onStart();
|
||||||
|
// Increased sensitivity for better feel
|
||||||
|
const delta = Math.abs(e.deltaY) * 0.008;
|
||||||
|
targetVelocity.current = Math.min(targetVelocity.current + delta, 1);
|
||||||
|
};
|
||||||
|
window.addEventListener('wheel', handleScroll, { passive: true });
|
||||||
|
return () => window.removeEventListener('wheel', handleScroll);
|
||||||
|
}, [onStart]);
|
||||||
|
|
||||||
|
useFrame((state, delta) => {
|
||||||
|
// Deceleration
|
||||||
|
targetVelocity.current = Math.max(targetVelocity.current - (0.4 * delta), 0);
|
||||||
|
// Smooth lerp
|
||||||
|
velocity.current = THREE.MathUtils.lerp(velocity.current, targetVelocity.current, 0.1);
|
||||||
|
onUpdate(velocity.current);
|
||||||
|
|
||||||
|
// Speed-based effects
|
||||||
|
state.camera.fov = 50 + (velocity.current * 25);
|
||||||
|
state.camera.updateProjectionMatrix();
|
||||||
|
|
||||||
|
if (velocity.current > 0.4) {
|
||||||
|
state.camera.position.x = (Math.random() - 0.5) * 0.08 * velocity.current;
|
||||||
|
state.camera.position.y = 2 + (Math.random() - 0.5) * 0.08 * velocity.current;
|
||||||
|
state.camera.position.z = 6 + (Math.random() - 0.5) * 0.04 * velocity.current;
|
||||||
|
} else {
|
||||||
|
state.camera.position.x = THREE.MathUtils.lerp(state.camera.position.x, 0, 0.1);
|
||||||
|
state.camera.position.y = THREE.MathUtils.lerp(state.camera.position.y, 2, 0.1);
|
||||||
|
state.camera.position.z = THREE.MathUtils.lerp(state.camera.position.z, 6, 0.1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function App() {
|
||||||
|
const [velocity, setVelocity] = useState(0);
|
||||||
|
const [showInstructions, setShowInstructions] = useState(true);
|
||||||
|
|
||||||
|
const onFrameUpdate = (v) => setVelocity(v);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div style={{ width: '100%', height: '100%' }}>
|
||||||
|
<Canvas shadows gl={{ antialias: true, powerPreference: "high-performance" }}>
|
||||||
|
<GameScene velocity={velocity} />
|
||||||
|
<GameBridge onUpdate={onFrameUpdate} onStart={() => setShowInstructions(false)} />
|
||||||
|
</Canvas>
|
||||||
|
|
||||||
|
<div id="ui-layer">
|
||||||
|
<div className="speed-indicator">
|
||||||
|
<div className="speed-label">Velocity</div>
|
||||||
|
<div className="speed-bar-container">
|
||||||
|
<div id="speed-bar" className="speed-bar" style={{ width: `${velocity * 100}%` }}></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className={`instructions ${showInstructions ? '' : 'hidden'}`}>
|
||||||
|
SCROLL TO RUN
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const root = ReactDOM.createRoot(document.getElementById('root'));
|
||||||
|
root.render(<App />);
|
||||||
183
index.php
183
index.php
@ -1,150 +1,111 @@
|
|||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
@ini_set('display_errors', '1');
|
@ini_set('display_errors', '0');
|
||||||
@error_reporting(E_ALL);
|
@error_reporting(E_ALL);
|
||||||
@date_default_timezone_set('UTC');
|
|
||||||
|
|
||||||
$phpVersion = PHP_VERSION;
|
// Read project preview data from environment
|
||||||
$now = date('Y-m-d H:i:s');
|
$projectName = $_SERVER['PROJECT_NAME'] ?? 'Animal Runner 3D';
|
||||||
|
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? 'Scroll to run in this infinite 3D world.';
|
||||||
|
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
||||||
?>
|
?>
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<title>New Style</title>
|
<title><?= htmlspecialchars($projectName) ?></title>
|
||||||
<?php
|
|
||||||
// Read project preview data from environment
|
|
||||||
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
|
|
||||||
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
|
||||||
?>
|
|
||||||
<?php if ($projectDescription): ?>
|
<?php if ($projectDescription): ?>
|
||||||
<!-- Meta description -->
|
<meta name="description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
||||||
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' />
|
|
||||||
<!-- Open Graph meta tags -->
|
|
||||||
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
||||||
<!-- Twitter meta tags -->
|
|
||||||
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php if ($projectImageUrl): ?>
|
<?php if ($projectImageUrl): ?>
|
||||||
<!-- Open Graph image -->
|
|
||||||
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
||||||
<!-- Twitter image -->
|
|
||||||
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;700&display=swap" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?= time() ?>">
|
||||||
<style>
|
<style>
|
||||||
:root {
|
/* Critical styles to prevent flash of content */
|
||||||
--bg-color-start: #6a11cb;
|
body, html, #root {
|
||||||
--bg-color-end: #2575fc;
|
background-color: #050505;
|
||||||
--text-color: #ffffff;
|
|
||||||
--card-bg-color: rgba(255, 255, 255, 0.01);
|
|
||||||
--card-border-color: rgba(255, 255, 255, 0.1);
|
|
||||||
}
|
|
||||||
body {
|
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-family: 'Inter', sans-serif;
|
padding: 0;
|
||||||
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
width: 100%;
|
||||||
color: var(--text-color);
|
height: 100%;
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
min-height: 100vh;
|
|
||||||
text-align: center;
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
position: relative;
|
|
||||||
}
|
}
|
||||||
body::before {
|
#loader-container {
|
||||||
content: '';
|
position: fixed;
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>');
|
background: #050505;
|
||||||
animation: bg-pan 20s linear infinite;
|
display: flex;
|
||||||
z-index: -1;
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
z-index: 1000;
|
||||||
|
transition: opacity 0.5s ease;
|
||||||
}
|
}
|
||||||
@keyframes bg-pan {
|
.loading-text {
|
||||||
0% { background-position: 0% 0%; }
|
color: white;
|
||||||
100% { background-position: 100% 100%; }
|
font-family: 'Inter', sans-serif;
|
||||||
|
font-size: 14px;
|
||||||
|
letter-spacing: 2px;
|
||||||
|
margin-top: 20px;
|
||||||
|
opacity: 0.5;
|
||||||
}
|
}
|
||||||
main {
|
.spinner {
|
||||||
padding: 2rem;
|
width: 30px;
|
||||||
}
|
height: 30px;
|
||||||
.card {
|
border: 2px solid rgba(255, 255, 255, 0.1);
|
||||||
background: var(--card-bg-color);
|
border-top-color: #39FF14;
|
||||||
border: 1px solid var(--card-border-color);
|
|
||||||
border-radius: 16px;
|
|
||||||
padding: 2rem;
|
|
||||||
backdrop-filter: blur(20px);
|
|
||||||
-webkit-backdrop-filter: blur(20px);
|
|
||||||
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
.loader {
|
|
||||||
margin: 1.25rem auto 1.25rem;
|
|
||||||
width: 48px;
|
|
||||||
height: 48px;
|
|
||||||
border: 3px solid rgba(255, 255, 255, 0.25);
|
|
||||||
border-top-color: #fff;
|
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
animation: spin 1s linear infinite;
|
animation: spin 1s linear infinite;
|
||||||
}
|
}
|
||||||
@keyframes spin {
|
@keyframes spin {
|
||||||
from { transform: rotate(0deg); }
|
to { transform: rotate(360deg); }
|
||||||
to { transform: rotate(360deg); }
|
|
||||||
}
|
|
||||||
.hint {
|
|
||||||
opacity: 0.9;
|
|
||||||
}
|
|
||||||
.sr-only {
|
|
||||||
position: absolute;
|
|
||||||
width: 1px; height: 1px;
|
|
||||||
padding: 0; margin: -1px;
|
|
||||||
overflow: hidden;
|
|
||||||
clip: rect(0, 0, 0, 0);
|
|
||||||
white-space: nowrap; border: 0;
|
|
||||||
}
|
|
||||||
h1 {
|
|
||||||
font-size: 3rem;
|
|
||||||
font-weight: 700;
|
|
||||||
margin: 0 0 1rem;
|
|
||||||
letter-spacing: -1px;
|
|
||||||
}
|
|
||||||
p {
|
|
||||||
margin: 0.5rem 0;
|
|
||||||
font-size: 1.1rem;
|
|
||||||
}
|
|
||||||
code {
|
|
||||||
background: rgba(0,0,0,0.2);
|
|
||||||
padding: 2px 6px;
|
|
||||||
border-radius: 4px;
|
|
||||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
||||||
}
|
|
||||||
footer {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 1rem;
|
|
||||||
font-size: 0.8rem;
|
|
||||||
opacity: 0.7;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<main>
|
<div id="loader-container">
|
||||||
<div class="card">
|
<div class="spinner"></div>
|
||||||
<h1>Analyzing your requirements and generating your website…</h1>
|
<div class="loading-text">LOADING 3D ENGINE</div>
|
||||||
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
</div>
|
||||||
<span class="sr-only">Loading…</span>
|
|
||||||
</div>
|
<div id="root"></div>
|
||||||
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p>
|
|
||||||
<p class="hint">This page will update automatically as the plan is implemented.</p>
|
<script type="importmap">
|
||||||
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
|
{
|
||||||
</div>
|
"imports": {
|
||||||
</main>
|
"react": "https://esm.sh/react",
|
||||||
<footer>
|
"react-dom/client": "https://esm.sh/react-dom/client",
|
||||||
Page updated: <?= htmlspecialchars($now) ?> (UTC)
|
"three": "https://esm.sh/three",
|
||||||
</footer>
|
"@react-three/fiber": "https://esm.sh/@react-three/fiber",
|
||||||
|
"@react-three/drei": "https://esm.sh/@react-three/drei"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script type="module" src="assets/js/game.js?v=<?= time() ?>"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
window.addEventListener('load', () => {
|
||||||
|
// Hide loader when React has mounted (roughly)
|
||||||
|
// The game.js will also handle its own Suspense
|
||||||
|
setTimeout(() => {
|
||||||
|
const loader = document.getElementById('loader-container');
|
||||||
|
if (loader) loader.style.opacity = '0';
|
||||||
|
setTimeout(() => {
|
||||||
|
if (loader) loader.style.display = 'none';
|
||||||
|
}, 500);
|
||||||
|
}, 2000);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Loading…
x
Reference in New Issue
Block a user