Interactive 3D aquariumOne-line
LFM2.5-2.6B (free)
by LiquidAIreasoning default159 console errors
Running live in a sandboxed frame. Click inside it before using the keyboard.
How it went
- Total time
- 9.9 s
- Cost
- $0
- Output tokens
- 3,900
- Spent thinking
- 2,397 tokens
- Speed
- 403.8 tok/s
- Console errors
- 159
- First token after
- 227 ms
- First visible text after
- 6.4 s
- Prompt tokens
- 450
- Code size
- 5.8 KB
- Finish reason
- stop
- Served by
- Liquid
- Model id
liquid/lfm-2.5-2.6b:free- Reasoning sent
model default- Max output
- 8,192 tokens
- Generated
- Nov 9, 2026
Console errors
Caught in the first 3 seconds after load, in a sandboxed iframe like the one above.
obj.getObject is not a function obj.getObject is not a function obj.getObject is not a function obj.getObject is not a function obj.getObject is not a function obj.getObject is not a function obj.getObject is not a function obj.getObject is not a function obj.getObject is not a function obj.getObject is not a function
What it was asked
The prompt
“a 3D aquarium with Three.js where the fish swim away when I move the mouse near them (Load Three.js only through this import map: <script type="importmap">{"imports":{"three":"https://cdn.jsdelivr.net/npm/three@0.170.0/build/three.module.js","three/addons/":"https://cdn.jsdelivr.net/npm/three@0.170.0/examples/jsm/"}}</script>)”
System prompt, sent with every prompt
You are generating a self-contained web demo. It will be rendered automatically in a sandboxed iframe and compared side by side with the output of other AI models given the exact same task. Output rules: - Reply with exactly ONE fenced code block containing the complete file: ```html (or ```svg when the task asks for an SVG). No text before or after the code block. - Everything must be inline: CSS in <style>, JavaScript in <script>. No external files, images, fonts or network requests, except the CDN URLs explicitly allowed by the task. - Do not use localStorage, sessionStorage, cookies, IndexedDB, alert(), confirm(), prompt() or window.open(): they are blocked in the sandbox and will throw. - The page must look right in a 1280×800 viewport and adapt gracefully down to 375px wide. No horizontal scrollbar. - Something meaningful must be visible on first paint: a screenshot is taken automatically about 3 seconds after load, without any interaction. - Everything that makes the demo interesting must be visible within the first seconds: nothing hidden behind a high score, a later level or a long play session. - Games must start in a self-playing demo mode (a simple AI plays) behind a "Click or press a key to start" message, so the game can be judged in action without playing. - The iframe only receives keyboard events after the user clicks it: if the demo uses the keyboard, display a clear "Click or press a key to start" message. - The code must run with zero errors in the console of the latest Chrome.
Code run-1.html · 171 lines
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>3D Aquarium - Fish Swim Away</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body { overflow: hidden; background: #000; }
canvas { display: block; }
#info {
position: absolute;
top: 20px;
left: 20px;
color: #fff;
font-family: 'Segoe UI', sans-serif;
font-size: 16px;
pointer-events: none;
text-shadow: 0 0 10px rgba(0,0,0,0.5);
z-index: 10;
}
#startBtn {
position: absolute;
bottom: 30px;
left: 50%;
transform: translateX(-50%);
padding: 12px 28px;
font-family: 'Segoe UI', sans-serif;
font-size: 14px;
background: rgba(0, 180, 255, 0.15);
color: #fff;
border: 2px solid #00d4ff;
border-radius: 8px;
cursor: pointer;
transition: all 0.3s ease;
}
#startBtn:hover {
background: rgba(0, 180, 255, 0.3);
box-shadow: 0 0 20px rgba(0, 180, 255, 0.4);
}
</style>
</head>
<body>
<div id="info">Move your mouse over fish to make them swim away</div>
<button id="startBtn" disabled>Start Game</button>
<script type="importmap">
{"imports":{"three":"https://cdn.jsdelivr.net/npm/three@0.170.0/build/three.module.js","three/addons/":"https://cdn.jsdelivr.net/npm/three@0.170.0/examples/jsm/"}}
</script>
<script type="module">
import * as THREE from 'three';
// Scene setup
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75, 1280/800, 0.1, 1000);
camera.position.set(0, 1.8, 6);
const renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setSize(1280, 800);
document.body.appendChild(renderer.domElement);
// Global ambient light
const ambientLight = new THREE.AmbientLight(0x404040, 3);
scene.add(ambientLight);
// Directional light for water effect
const dirLight = new THREE.DirectionalLight(0xffffff, 1.5);
dirLight.position.set(8, 12, 6);
scene.add(dirLight);
// Water surface plane
const waterGeometry = new THREE.PlaneGeometry(12, 12, 50, 50);
const waterMaterial = new THREE.MeshStandardMaterial({
color: 0x1a6aff,
roughness: 0.9,
metalness: 0.1
});
const water = new THREE.Mesh(waterGeometry, waterMaterial);
water.rotation.x = -Math.PI / 2;
water.position.y = 5;
scene.add(water);
// Tank background
const tankGeometry = new THREE.CylinderGeometry(7, 7, 10, 64);
const tankMaterial = new THREE.MeshStandardMaterial({ color: 0x1a8cff, roughness: 0.8 });
const tank = new THREE.Mesh(tankGeometry, tankMaterial);
tank.position.y = 8;
scene.add(tank);
// Create fish
const fishCount = 8;
const fishColors = [
0xff6b35, 0x4ecdc4, 0xffd166, 0x9b59b6, 0xe67e22, 0x1abc9c,
0xff6b6b, 0x4d96ff
];
const fish = [];
for (let i = 0; i < fishCount; i++) {
const x = (Math.random() - 0.5) * 5;
const z = (Math.random() - 0.5) * 5;
const color = fishColors[i % fishColors.length];
const radius = 0.7 + Math.random() * 0.3;
const fishObj = new THREE.Object3D();
fishObj.position.set(x, 0.5, z);
fishObj.scale.set(1, 0.6, 1);
const fishMesh = new THREE.Mesh(
new THREE.SphereGeometry(radius, 16, 16),
new THREE.MeshStandardMaterial({ color: color, roughness: 0.4 })
);
fishObj.add(fishMesh);
scene.add(fishObj);
fish.push(fishObj);
}
// Mouse tracking
const mouse = new THREE.Vector2();
document.addEventListener('mousemove', (e) => {
mouse.x = (e.clientX / window.innerWidth) * 2 - 1;
mouse.y = -(e.clientY / window.innerHeight) * 2 + 1;
});
// Start button
const startBtn = document.getElementById('startBtn');
startBtn.addEventListener('click', () => {
startBtn.disabled = true;
startBtn.textContent = 'Playing...';
// Reset fish positions
fish.forEach((obj, i) => {
obj.position.set((Math.random() - 0.5) * 5, 0.5, (Math.random() - 0.5) * 5);
});
});
// Animation loop
const animate = () => {
requestAnimationFrame(animate);
// Update fish positions
fish.forEach(obj => {
const fish = obj.getObject();
const pos = fish.position;
// Base swimming motion
fish.angle += 0.015;
fish.rotation += 0.004;
// Check distance to mouse
const dx = pos.x - mouse.x;
const dz = pos.z - mouse.z;
const dist = Math.sqrt(dx * dx + dz * dz);
if (dist < 3.5) {
// Swim away from mouse
fish.x += (mouse.x - pos.x) * 0.06;
fish.z += (mouse.z - pos.z) * 0.06;
} else {
// Normal swimming
fish.x += Math.sin(fish.angle) * 0.08;
fish.z += Math.cos(fish.angle) * 0.08;
}
// Update position
pos.set(fish.x, fish.y + fish.radius, fish.z);
fish.position.set(pos);
});
renderer.render(scene, camera);
};
animate();
</script>
</body>
</html>Reasoning trace (2,397 tokens)
The user wants a 3D aquarium with Three.js where fish swim away when the mouse is near them. I need to create a self-contained HTML file with:
1. Three.js loaded via import map
2. A 3D aquarium scene
3. Fish that swim around
4. When the mouse moves near a fish, the fish swims away (or reacts to the mouse position)
Let me plan the implementation:
- Use Three.js from the provided import map
- Create a scene with a water tank (blue background, maybe some waves)
- Add fish (simple 3D shapes like spheres with fish patterns)
- When mouse moves, detect which fish is closest to the mouse
- If mouse is near a fish, make that fish swim away (change its position/rotation)
Key features:
- Aquarium tank with water effect
- Multiple fish swimming
- Mouse interaction: when mouse is near a fish, the fish swims away
- Self-playing demo mode (AI plays) - but the main requirement is the mouse interaction
- The page should be responsive (1280x800 viewport, adapt to smaller screens)
Let me create the HTML file with all the necessary code. I'll use Three.js examples for the water and fish.
For the water, I can use a simple shader or a cube with a gradient. For fish, I'll create simple 3D models using spheres with different colors.
The interaction: when the mouse moves, I'll check the distance from the mouse to each fish. If the mouse is within a certain radius, the fish will swim away (move in the opposite direction or change its swimming pattern).
Let me write the code:
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>3D Aquarium - Fish Swim Away</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body { overflow: hidden; background: #000; }
canvas { display: block; }
#info {
position: absolute;
top: 10px;
left: 10px;
color: white;
font-family: sans-serif;
pointer-events: none;
text-shadow: 1px 1px 2px black;
}
</style>
</head>
<body>
<div id="info">Move mouse over fish to make them swim away</div>
<script type="importmap">
{"imports":{"three":"https://cdn.jsdelivr.net/npm/three@0.170.0/build/three.module.js","three/addons/":"https://cdn.jsdelivr.net/npm/three@0.170.0/examples/jsm/"}}
</script>
<script type="module">
import * as THREE from 'three';
// Scene setup
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75, 1280/800, 0.1, 1000);
camera.position.set(0, 1.5, 5);
const renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setSize(1280, 800);
document.body.appendChild(renderer.domElement);
// Lighting
const ambientLight = new THREE.AmbientLight(0x404040, 2);
scene.add(ambientLight);
const directionalLight = new THREE.DirectionalLight(0xffffff, 1);
directionalLight.position.set(5, 10, 7);
scene.add(directionalLight);
// Water tank - background
const tankGeometry = new THREE.CylinderGeometry(8, 8, 12, 32);
const tankMaterial = new THREE.MeshStandardMaterial({ color: 0x1a8cff, roughness: 0.9 });
const tank = new THREE.Mesh(tankGeometry, tankMaterial);
tank.position.y = 6;
scene.add(tank);
// Fish class
class Fish {
constructor(x, z, color) {
this.x = x;
this.z = z;
this.color = color;
this.radius = 0.8;
this.swimSpeed = 0.3;
this.angle = Math.random() * Math.PI * 2;
this.rotation = Math.random() * Math.PI * 2;
this.mouseDistance = Infinity;
this.isNearMouse = false;
}
update() {
// Base swimming motion
this.angle += 0.02;
this.rotation += 0.005;
// Swim away from mouse if close
const mousePos = camera.position;
const dx = this.x - mousePos.x;
const dz = this.z - mousePos.z;
const dist = Math.sqrt(dx*dx + dz*dz);
if (dist < 3) {
this.mouseDistance = dist;
this.isNearMouse = true;
// Swim away from mouse
this.x += (mousePos.x - this.x) * 0.05;
this.z += (mousePos.z - this.z) * 0.05;
} else {
this.mouseDistance = Infinity;
this.isNearMouse = false;
// Normal swimming
this.x += Math.sin(this.angle) * 0.1;
this.z += Math.cos(this.angle) * 0.1;
}
// Update position
this.position.set(this.x, this.y + this.radius, this.z);
}
get worldPosition() {
return new THREE.Vector3(this.x, this.y + this.radius, this.z);
}
}
// Create fish
const fishCount = 6;
const fishColors = [0xff6b35, 0x4ecdc4, 0xffd166, 0x9b59b6, 0xe67e22, 0x1abc9c];
for (let i = 0; i < fishCount; i++) {
const x = (Math.random() - 0.5) * 6;
const z = (Math.random() - 0.5) * 6;
const color = fishColors[i % fishColors.length];
const fish = new Fish(x, z, color);
scene.add(fish);
}
// Mouse interaction
const mouse = new THREE.Vector2();
document.addEventListener('mousemove', (e) => {
mouse.x = (e.clientX / window.innerWidth) * 2 - 1;
mouse.y = -(e.clientY / window.innerHeight) * 2 + 1;
});
// Animation loop
const animate = () => {
requestAnimationFrame(animate);
fishCount.forEach(fish => {
fish.update();
});
renderer.render(scene, camera);
};
animate();
</script>
</body>
</html>
```
Wait, I need to make sure the fish actually react to the mouse. The current implementation has the fish swim away when the mouse is near, but I should also make sure the fish are visible and the aquarium looks good.
Let me refine:
1. Add some water surface effect (maybe a plane with a gradient)
2. Make the fish more visually distinct
3. Ensure the mouse interaction is clear
Actually, looking at the requirements more carefully:
- "fish swim away when I move the mouse near them" - this is the main interaction
- "Games must start in a self-playing demo mode (a simple AI plays)" - this suggests there should be some AI behavior, but the main focus is the mouse interaction
I think the current approach is good. The fish will swim away when the mouse is near them. Let me also add a water surface plane for better visual effect.
Let me also make sure the page is responsive and adapts well. The viewport is 1280x800, and it should adapt gracefully down to 375px.
One issue: the fish might get stuck if the mouse is always near one fish. I should add some randomness or make the reaction more subtle. But the requirement is clear: "fish swim away when I move the mouse near them" - so this behavior is expected.
Let me finalize the code and make sure it's complete and runs without errors. I'll add:
- A water surface plane
- Better fish visuals (maybe with some texture or just colored spheres)
- Responsive design
Actually, I realize I should also handle the case where the user hasn't clicked yet - the "Click or press a key to start" message. But since Three.js is already loaded and the scene is visible, the fish will be swimming away when the mouse moves. The "start" message might be for a game mode, but the task says "Games must start in a self-playing demo mode" - so the fish swimming away is the demo mode.
Let me finalize the code. I'll make sure:
1. The import map is correctly set up
2. Three.js is loaded properly
3. The aquarium scene is visible
4. Fish react to mouse proximity
5. The page is responsive
One more thing - I should add a way to start the game. The task says "Click or press a key to start" - but since the fish are already swimming away when the mouse is near, maybe the "start" is implicit. However, to be safe, I'll add a simple start button or make the fish start swimming immediately.
Actually, looking at the task again: "Games must start in a self-playing demo mode (a simple AI plays) behind a 'Click or press a key to start' message". This suggests there should be a start state where nothing happens until the user interacts. But the main interaction (fish swimming away) is the demo mode.
I think the best approach is:
- Initially, fish are swimming normally
- When mouse moves near a fish, it swims away
- The "start" message can be shown until the user interacts
But actually, the fish are already swimming away when the mouse is near. So the "start" message might be redundant. Let me just make sure the scene is visible and the interaction works.
Let me write the final code. I'll keep it clean and focused.