111 lines
3.4 KiB
PHP
111 lines
3.4 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
@ini_set('display_errors', '0');
|
|
@error_reporting(E_ALL);
|
|
|
|
// Read project preview data from environment
|
|
$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>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
<title><?= htmlspecialchars($projectName) ?></title>
|
|
<?php if ($projectDescription): ?>
|
|
<meta name="description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
<?php endif; ?>
|
|
<?php if ($projectImageUrl): ?>
|
|
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
|
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
|
<?php endif; ?>
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
<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>
|
|
/* Critical styles to prevent flash of content */
|
|
body, html, #root {
|
|
background-color: #050505;
|
|
margin: 0;
|
|
padding: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
overflow: hidden;
|
|
}
|
|
#loader-container {
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
background: #050505;
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: center;
|
|
align-items: center;
|
|
z-index: 1000;
|
|
transition: opacity 0.5s ease;
|
|
}
|
|
.loading-text {
|
|
color: white;
|
|
font-family: 'Inter', sans-serif;
|
|
font-size: 14px;
|
|
letter-spacing: 2px;
|
|
margin-top: 20px;
|
|
opacity: 0.5;
|
|
}
|
|
.spinner {
|
|
width: 30px;
|
|
height: 30px;
|
|
border: 2px solid rgba(255, 255, 255, 0.1);
|
|
border-top-color: #39FF14;
|
|
border-radius: 50%;
|
|
animation: spin 1s linear infinite;
|
|
}
|
|
@keyframes spin {
|
|
to { transform: rotate(360deg); }
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="loader-container">
|
|
<div class="spinner"></div>
|
|
<div class="loading-text">LOADING 3D ENGINE</div>
|
|
</div>
|
|
|
|
<div id="root"></div>
|
|
|
|
<script type="importmap">
|
|
{
|
|
"imports": {
|
|
"react": "https://esm.sh/react",
|
|
"react-dom/client": "https://esm.sh/react-dom/client",
|
|
"three": "https://esm.sh/three",
|
|
"@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>
|
|
</html>
|