algorithmic-arboretum / index.html
singlecell's picture
create a website called "algorithmic garden" that uses webxr or xr.js plus three.js to display a list of .glb models that can overlayed over whatever a cellphone camera sees (AR). There should be pinch to zoom and rotate commands on the phone interface.
e34da73 verified
<!DOCTYPE html>
<html lang="en" class="h-full">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Algorithmic ARboretum - An immersive AR garden experience">
<title>Algorithmic ARboretum 🌿</title>
<link rel="stylesheet" href="style.css">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<script src="https://unpkg.com/feather-icons"></script>
<script src="https://cdn.jsdelivr.net/npm/three@0.132.2/build/three.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/three@0.132.2/examples/js/controls/OrbitControls.js"></script>
<script src="https://cdn.jsdelivr.net/npm/three@0.132.2/examples/js/loaders/GLTFLoader.js"></script>
<script src="https://cdn.jsdelivr.net/npm/three@0.132.2/examples/js/WebXR.js"></script>
</head>
<body class="bg-emerald-50 dark:bg-gray-900 text-gray-900 dark:text-emerald-50 min-h-screen flex flex-col">
<custom-header></custom-header>
<main class="flex-grow container mx-auto px-4 py-8">
<div id="ar-container" class="relative rounded-xl overflow-hidden shadow-xl">
<!-- AR Viewport will be inserted here -->
<div id="xr-button" class="absolute top-4 right-4 z-10">
<button class="bg-emerald-500 hover:bg-emerald-600 text-white px-4 py-2 rounded-full flex items-center gap-2 transition-all">
<i data-feather="eye"></i> Enter AR
</button>
</div>
<div id="loading" class="absolute inset-0 bg-black bg-opacity-70 flex items-center justify-center text-white">
<div class="text-center">
<div class="animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-emerald-500 mx-auto mb-4"></div>
<p>Loading AR experience...</p>
</div>
</div>
<canvas id="ar-viewport" class="w-full h-full min-h-[60vh]"></canvas>
</div>
<section class="mt-12">
<h2 class="text-2xl font-bold mb-6 flex items-center gap-2">
<i data-feather="grid"></i> Available Plants
</h2>
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6" id="model-gallery">
<!-- Models will be loaded here -->
</div>
</section>
<div id="ar-controls" class="fixed bottom-0 left-0 right-0 bg-white dark:bg-gray-800 shadow-lg p-4 flex justify-center gap-6 hidden">
<button id="rotate-btn" class="bg-emerald-500 hover:bg-emerald-600 text-white p-3 rounded-full">
<i data-feather="rotate-cw"></i>
</button>
<button id="scale-btn" class="bg-emerald-500 hover:bg-emerald-600 text-white p-3 rounded-full">
<i data-feather="maximize-2"></i>
</button>
<button id="place-btn" class="bg-emerald-500 hover:bg-emerald-600 text-white p-3 rounded-full">
<i data-feather="map-pin"></i>
</button>
</div>
</main>
<custom-footer></custom-footer>
<!-- Web Components -->
<script src="components/header.js"></script>
<script src="components/footer.js"></script>
<script src="script.js"></script>
<script>
feather.replace();
</script>
<script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
</body>
</html>