Truncated at 32000 tokens
View raw output
Here's a complete, self-contained HTML page that renders a 3D pelican riding a bicycle with three.js, featuring a slow orbiting camera.
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Pelican on a Bicycle</title>
<style>
html, body { margin: 0; padding: 0; height: 100%; overflow: hidden; background: #9fd6f2; }
canvas { display: block; }
</style>
</head>
<body>
<script src="https://goodharts.ai/static/vendor/three/r149/three.min.js"></script>
<script>
(function () {
"use strict";
/* ----------------------------------------------------------- renderer */
var renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
if (THREE.sRGBEncoding !== undefined) renderer.outputEncoding = THREE.sRGBEncoding;
document.body.appendChild(renderer.domElement);
var scene = new THREE.Scene();
scene.background = new THREE.Color(0x9fd6f2);
scene.fog = new THREE.Fog(0x9fd6f2, 16, 42);
var camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 200);
/* ------------------------------------------------------------- lights */
var hemi = new THREE.HemisphereLight(0xe6f3ff, 0x557a3c, 1.05);
scene.add(hemi);
var sun = new THREE.DirectionalLight(0xfff3da, 1.35);
sun.position.set(5.5, 9.5, 6.5);
sun.castShadow = true;
sun.shadow.mapSize.width = 1024;
sun.shadow.mapSize.height = 1024;
sun.shadow.camera.left = -5;
sun.shadow.camera.right = 5;
sun.shadow.camera.top = 5;
sun.shadow.camera.bottom = -5;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 30;
sun.shadow.bias = -0.0006;
sun.shadow.normalBias = 0.02;
scene.add(sun);
var fill = new THREE.DirectionalLight(0xbfd8ff, 0.55);
fill.position.set(-7, 4.5, -6);
scene.add(fill);
/* ------------------------------------------------------------ ground */
var ground = new THREE.Mesh(
new THREE.PlaneGeometry(80, 80),
new THREE.MeshStandardMaterial({ color: 0x93c26a, roughness: 1, metalness: 0 })
);
ground.rotation.x = -Math.PI / 2;
ground.receiveShadow = true;
scene.add(ground);
/* --------------------------------------------------------- materials */
var mat = {
body: new THREE.MeshStandardMaterial({ color: 0xfbf8f0, roughness: 0.9, metalness: 0.0 }),
beak: new THREE.MeshStandardMaterial({ color: 0xf3a02a, roughness: 0.55, metalness: 0.05 }),
pouch: new THREE.MeshStandardMaterial({ color: 0xffc95e, roughness: 0.7, metalness: 0.0 }),
eye: new THREE.MeshStandardMaterial({ color: 0x1a1a1e, roughness: 0.25, metalness: 0.1 }),
tire: new THREE.MeshStandardMaterial({ color: 0x26262b, roughness: 0.95, metalness: 0.0 }),
metal: new THREE.MeshStandardMaterial({ color: 0xd9dee6, roughness: 0.32, metalness: 0.45 }),
frame: new THREE.MeshStandardMaterial({ color: 0xd93b2b, roughness: 0.38, metalness: 0.3 }),
dark: new THREE.MeshStandardMaterial({ color: 0x2c2c33, roughness: 0.8, metalness: 0.1 })
};
/* ----------------------------------------------------------- helpers */
var UP = new THREE.Vector3(0, 1, 0);
function place(mesh, a, b, sx, sz) {
var dir = new THREE.Vector3().subVectors(b, a);
var len = dir.length();
if (len < 1e-6) len = 1e-6;
mesh.position.copy(a).addScaledVector(dir, 0.5);
mesh.quaternion.setFromUnitVectors(UP, dir.clone().divideScalar(len));
mesh.scale.set(sx === undefined ? 1 : sx, len, sz === undefined ? 1 : sz);
return mesh;
}
function tube(a, b, r, material) {
var m = new THREE.Mesh(new THREE.CylinderGeometry(r, r, 1, 12), material);
place(m, a, b);
return m;
}
/* ============================================================ BICYCLE */
var bike = new THREE.Group();
scene.add(bike);
var R = 0.45; // wheel radius
var rearHub = new THREE.Vector3(-0.66, R, 0);
var frontHub = new THREE.Vector3( 0.66, R, 0);
var BB = new THREE.Vector3( 0.00, 0.42, 0); // bottom bracket
var seatTop = new THREE.Vector3(-0.44, 1.22, 0);
var headTop = new THREE.Vector3( 0.42, 1.18, 0);
var headBot = new THREE.Vector3( 0.50, 0.92, 0);
var barPos = new THREE.Vector3( 0.44, 1.27, 0);
var CRANK = 0.16;
function makeWheel() {
var g = new THREE.Group();
var tire = new THREE.Mesh(new THREE.TorusGeometry(R, 0.05, 12, 44), mat.tire);
g.add(tire);
var rim = new THREE.Mesh(new THREE.TorusGeometry(R - 0.07, 0.02, 8, 44), mat.metal);
g.add(rim);
var hub = new THREE.Mesh(new THREE.CylinderGeometry(0.04, 0.04, 0.13, 10), mat.metal);
hub.rotation.x = Math.PI / 2;
g.add(hub);
for (var i = 0; i < 8; i++) {
var spoke = new THREE.Mesh(
new THREE.CylinderGeometry(0.006, 0.006, (R - 0.08) * 2, 4), mat.metal
);
spoke.rotation.z = i * Math.PI / 8;
g.add(spoke);
}
return g;
}
var rearWheel = makeWheel();
rearWheel.position.copy(rearHub);
bike.add(rearWheel);
var frontWheel = makeWheel();
frontWheel.position.copy(frontHub);
bike.add(frontWheel);
/* frame */
bike.add(tube(rearHub, BB, 0.022, mat.frame)); // chain stay
bike.add(tube(rearHub, seatTop, 0.020, mat.frame)); // seat stay
bike.add(tube(BB, seatTop, 0.028, mat.frame)); // seat tube
bike.add(tube(BB, headBot, 0.030, mat.frame)); // down tube
bike.add(tube(seatTop, headTop, 0.026, mat.frame)); // top tube
bike.add(tube(headTop, headBot, 0.032, mat.frame)); // head tube
bike.add(tube(headBot, frontHub, 0.024, mat.frame)); // fork
bike.add(tube(headTop, barPos, 0.022, mat.metal)); // stem
/* handlebar */
var bar = new THREE.Mesh(new THREE.CylinderGeometry(0.022, 0.022, 0.64, 10), mat.metal);
bar.rotation.x = Math.PI / 2;
bar.position.copy(barPos);
bike.add(bar);
[-1, 1].forEach(function (s) {
var grip = new THREE.Mesh(new THREE.CylinderGeometry(0.028, 0.028, 0.12, 10), mat.dark);
grip.rotation.x = Math.PI / 2;
grip.position.set(barPos.x, barPos.y, 0.28 * s);
bike.add(grip);
});
/* saddle */
var saddle = new THREE.Mesh(new THREE.SphereGeometry(0.5, 18, 12), mat.dark);
saddle.scale.set(0.40, 0.10, 0.20);
saddle.position.set(-0.45, 1.25, 0);
bike.add(saddle);
/* chainring, cog and chain */
var chainring = new THREE.Mesh(new THREE.CylinderGeometry(0.12, 0.12, 0.02, 24), mat.metal);
chainring.rotation.x = Math.PI / 2;
chainring.position.set(BB.x, BB.y, 0.12);
bike.add(chainring);
var cog = new THREE.Mesh(new THREE.CylinderGeometry(0.05, 0.05, 0.02, 16), mat.metal);
cog.rotation.x = Math.PI / 2;
cog.position.set(rearHub.x, rearHub.y, 0.08);
bike.add(cog);
bike.add(tube(new THREE.Vector3(BB.x, BB.y + 0.12, 0.12),
new THREE.Vector3(rearHub.x, rearHub.y + 0.05, 0.08), 0.008, mat.dark));
bike.add(tube(new THREE.Vector3(BB.x, BB.y - 0.12, 0.12),
new THREE.Vector3(rearHub.x, rearHub.y - 0.05, 0.08), 0.008, mat.dark));
/* crank arms + pedals (updated every frame) */
var crankArmL = new THREE.Mesh(new THREE.CylinderGeometry(0.022, 0.022, 1, 10), mat.metal);
var crankArmR = new THREE.Mesh(new THREE.CylinderGeometry(0.022, 0.022, 1, 10), mat.metal);
bike.add(crankArmL, crankArmR);
var pedalL = new THREE.Mesh(new THREE.BoxGeometry(0.13, 0.025, 0.09), mat.dark);
var pedalR = new THREE.Mesh(new THREE.BoxGeometry(0.13, 0.025, 0.09), mat.dark);
bike.add(pedalL, pedalR);
/* ============================================================ PELICAN */
var bird = new THREE.Group();
scene.add(bird);
/* body */
var body = new THREE.Mesh(new THREE.SphereGeometry(0.42, 28, 20), mat.body);
body.position.set(-0.40, 1.60, 0);
body.scale.set(1.25, 1.0, 0.95);
bird.add(body);
/* tail */
var tail = new THREE.Mesh(new THREE.ConeGeometry(0.16, 0.46, 14), mat.body);
tail.position.set(-0.95, 1.74, 0);
tail.rotation.z = Math.PI * 0.28;
tail.scale.z = 0.55;
bird.add(tail);
/* neck */
var neckCurve = new THREE.CatmullRomCurve3([
new THREE.Vector3(-0.05, 1.82, 0),
new THREE.Vector3( 0.00, 2.05, 0),
new THREE.Vector3( 0.08, 2.28, 0),
new THREE.Vector3( 0.16, 2.42, 0)
]);
var neck = new THREE.Mesh(new THREE.TubeGeometry(neckCurve, 40, 0.115, 14, false), mat.body);
bird.add(neck);
/* head */
var headPos = new THREE.Vector3(0.20, 2.48, 0);
var head = new THREE.Mesh(new THREE.Sp