Prompt specification
Build or customize the Three.js 3D scene "Vegetable fermentation jar cutaway" inside the active workspace.
Engineering Constraints:
1. Runtime & Orbit: Use Three.js r160 with OrbitControls (damping enabled) and ACESFilmicToneMapping.
2. Frame Timing: Drive all motion strictly with clock.getDelta() so animation speed is FPS-independent.
3. Viewport Hygiene: Handle window resize cleanly, cap DPR at Math.min(window.devicePixelRatio, 2), and dispose geometries/materials/renderer on unmount.
Scene Metadata:
Scene: Vegetable fermentation jar cutaway
Category: Everyday & Industrial · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/vegetable-fermentation-jar-cutaway-x0105
Scene Description Prompt:
Create a single self-contained HTML file using Three.js from cdnjs that shows vegetable fermentation. Show a jar filled with layered vegetables under a liquid surface and a small weight; expose the submerged arrangement without providing ingredient amounts or preparation instructions. Stylized solid forms.
Working Three.js Starter (vegetable-fermentation-jar-cutaway-x0105):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Fermentation — Cutaway Study</title>
<style>
:root {
--ink: #24342f;
--muted: #66746d;
--paper: #e9e4d8;
--glass: #f8f4e9;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: var(--paper);
color: var(--ink);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
cursor: grab;
}
canvas:active {
cursor: grabbing;
}
.title-block {
position: fixed;
top: clamp(24px, 5vw, 56px);
left: clamp(24px, 5vw, 64px);
z-index: 2;
max-width: 380px;
pointer-events: none;
}
.eyebrow {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 12px;
color: var(--muted);
font-size: 11px;
font-weight: 700;
letter-spacing: 0.22em;
text-transform: uppercase;
}
.eyebrow::before {
width: 30px;
height: 1px;
content: "";
background: #8d9b91;
}
h1 {
margin: 0;
font-family: Georgia, "Times New Roman", serif;
font-size: clamp(42px, 6vw, 76px);
font-weight: 400;
line-height: 0.94;
letter-spacing: -0.045em;
}
.subtitle {
max-width: 315px;
margin: 18px 0 0;
color: var(--muted);
font-size: 14px;
line-height: 1.65;
}
.scene-label {
position: fixed;
right: clamp(18px, 4vw, 48px);
top: clamp(22px, 4vw, 46px);
z-index: 2;
display: flex;
align-items: center;
gap: 9px;
padding: 10px 13px;
border: 1px solid rgba(49, 70, 61, 0.17);
border-radius: 999px;
background: rgba(248, 244, 233, 0.62);
color: #53655c;
font-size: 10px;
font-weight: 700;
letter-spacing: 0.15em;
text-transform: uppercase;
backdrop-filter: blur(10px);
pointer-events: none;
}
.scene-label span {
width: 6px;
height: 6px;
border-radius: 50%;
background: #c69243;
box-shadow: 0 0 0 4px rgba(198, 146, 67, 0.14);
}
.controls {
position: fixed;
right: clamp(18px, 4vw, 48px);
bottom: clamp(18px, 4vw, 42px);
z-index: 2;
padding: 9px 13px;
border: 1px solid rgba(49, 70, 61, 0.14);
border-radius: 999px;
background: rgba(248, 244, 233, 0.62);
color: #65736d;
font-size: 10px;
font-weight: 650;
letter-spacing: 0.08em;
text-transform: uppercase;
backdrop-filter: blur(10px);
pointer-events: none;
}
.corner-mark {
position: fixed;
left: clamp(24px, 5vw, 64px);
bottom: clamp(24px, 4vw, 44px);
z-index: 2;
width: 42px;
height: 42px;
border-left: 1px solid rgba(47, 67, 58, 0.28);
border-bottom: 1px solid rgba(47, 67, 58, 0.28);
pointer-events: none;
}
.corner-mark::after {
position: absolute;
right: 0;
bottom: 12px;
width: 16px;
height: 1px;
content: "";
background: rgba(47, 67, 58, 0.28);
}
@media (max-width: 700px) {
.subtitle {
max-width: 240px;
font-size: 12px;
}
.scene-label {
top: auto;
bottom: 72px;
}
.controls {
left: 50%;
right: auto;
transform: translateX(-50%);
white-space: nowrap;
}
}
</style>
</head>
<body>
<header class="title-block">
<div class="eyebrow">Cutaway study</div>
<h1>Fermentation</h1>
<p class="subtitle">
A stylized view of layered vegetables held beneath a translucent liquid surface.
</p>
</header>
<div class="scene-label"><span></span> Submerged arrangement</div>
<div class="controls">Drag to orbit · Scroll to zoom</div>
<div class="corner-mark" aria-hidden="true"></div>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
// -------------------------------------------------------------------------
// Scene
// -------------------------------------------------------------------------
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xe9e4d8);
scene.fog = new THREE.Fog(0xe9e4d8, 14, 27);
const camera = new THREE.PerspectiveCamera(
38,
window.innerWidth / window.innerHeight,
0.1,
50
);
const renderer = new THREE.WebGLRenderer({
antialias: true,
alpha: false,
powerPreference: "high-performance"
});
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.05;
renderer.domElement.setAttribute(
"aria-label",
"Interactive three-dimensional cutaway of vegetables fermenting in a jar"
);
document.body.prepend(renderer.domElement);
const hemiLight = new THREE.HemisphereLight(0xfff8e8, 0x6f8876, 2.1);
scene.add(hemiLight);
const keyLight = new THREE.DirectionalLight(0xfff0cf, 3.2);
keyLight.position.set(5, 10, 6);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(2048, 2048);
keyLight.shadow.camera.left = -7;
keyLight.shadow.camera.right = 7;
keyLight.shadow.camera.top = 9;
keyLight.shadow.camera.bottom = -4;
keyLight.shadow.camera.near = 0.5;
keyLight.shadow.camera.far = 25;
keyLight.shadow.bias = -0.0005;
scene.add(keyLight);
const fillLight = new THREE.DirectionalLight(0xaed7d0, 1.25);
fillLight.position.set(-6, 5, 1);
scene.add(fillLight);
const rimLight = new THREE.PointLight(0xd5f0e8, 20, 14, 2);
rimLight.position.set(2, 4, -5);
scene.add(rimLight);
// -------------------------------------------------------------------------
// Ground and pedestal
// -------------------------------------------------------------------------
const ground = new THREE.Mesh(
new THREE.PlaneGeometry(40, 40),
new THREE.MeshStandardMaterial({
color: 0xe7e1d4,
roughness: 0.95,
metalness: 0
})
);
ground.rotation.x = -Math.PI / 2;
ground.position.y = -0.08;
ground.receiveShadow = true;
scene.add(ground);
const pedestal = new THREE.Mesh(
new THREE.CylinderGeometry(3.35, 3.5, 0.34, 72),
new THREE.MeshStandardMaterial({
color: 0xd3cbb9,
roughness: 0.88,
metalness: 0.02
})
);
pedestal.position.y = 0.09;
pedestal.receiveShadow = true;
pedestal.castShadow = true;
scene.add(pedestal);
const pedestalInset = new THREE.Mesh(
new THREE.TorusGeometry(3.14, 0.025, 8, 96),
new THREE.MeshStandardMaterial({
color: 0xb5ad9c,
roughness: 0.75
})
);
pedestalInset.rotation.x = Math.PI / 2;
pedestalInset.position.y = 0.27;
scene.add(pedestalInset);
// -------------------------------------------------------------------------
// Cutaway glass jar
// The front sector is intentionally omitted to reveal the submerged forms.
// -------------------------------------------------------------------------
const PHI_START = 0.98;
const PHI_LENGTH = Math.PI * 2 - 1.62;
const jarProfile = [
new THREE.Vector2(1.62, 0.32),
new THREE.Vector2(1.9, 0.37),
new THREE.Vector2(2.02, 0.58),
new THREE.Vector2(2.06, 1.0),
new THREE.Vector2(2.06, 4.93),
new THREE.Vector2(1.82, 5.34),
new THREE.Vector2(1.7, 5.76),
new THREE.Vector2(1.78, 5.91)
];
const glassMaterial = new THREE.MeshPhysicalMaterial({
color: 0xa8d0cb,
transparent: true,
opacity: 0.19,
roughness: 0.16,
metalness: 0.02,
clearcoat: 0.7,
clearcoatRoughness: 0.22,
side: THREE.DoubleSide,
depthWrite: false
});
const jar = new THREE.Mesh(
new THREE.LatheGeometry(
jarProfile,
80,
PHI_START,
PHI_LENGTH
),
glassMaterial
);
jar.renderOrder = 2;
scene.add(jar);
const jarBase = new THREE.Mesh(
new THREE.CylinderGeometry(
1.89,
1.89,
0.16,
64,
1,
false,
PHI_START,
PHI_LENGTH
),
glassMaterial
);
jarBase.position.y = 0.35;
jarBase.renderOrder = 2;
scene.add(jarBase);
function makeArcTube(radius, y, tubeRadius, material) {
const points = [];
for (let i = 0; i <= 64; i++) {
const angle = PHI_START + (PHI_LENGTH * i) / 64;
points.push(
new THREE.Vector3(
Math.sin(angle) * radius,
y,
Math.cos(angle) * radius
)
);
}
const curve = new THREE.CatmullRomCurve3(points, false, "centripetal");
const mesh = new THREE.Mesh(
new THREE.TubeGeometry(curve, 96, tubeRadius, 7, false),
material
);
scene.add(mesh);
return mesh;
}
const edgeMaterial = new THREE.MeshStandardMaterial({
color: 0x86aaa5,
transparent: true,
opacity: 0.62,
roughness: 0.28,
metalness: 0.08
});
makeArcTube(1.78, 5.91, 0.045, edgeMaterial);
makeArcTube(1.9, 0.39, 0.035, edgeMaterial);
const edgePoints = [
new THREE.Vector3(Math.sin(PHI_START) * 1.92, 0.4, Math.cos(PHI_START) * 1.92),
new THREE.Vector3(Math.sin(PHI_START) * 2.04, 0.65, Math.cos(PHI_START) * 2.04),
new THREE.Vector3(Math.sin(PHI_START) * 2.06, 1.05, Math.cos(PHI_START) * 2.06),
new THREE.Vector3(Math.sin(PHI_START) * 2.06, 4.9, Math.cos(PHI_START) * 2.06),
new THREE.Vector3(Math.sin(PHI_START) * 1.82, 5.34, Math.cos(PHI_START) * 1.82),
new THREE.Vector3(Math.sin(PHI_START) * 1.7, 5.76, Math.cos(PHI_START) * 1.7),
new THREE.Vector3(Math.sin(PHI_START) * 1.78, 5.91, Math.cos(PHI_START) * 1.78)
];
const endAngle = PHI_START + PHI_LENGTH;
const oppositeEdgePoints = edgePoints.map(
(point) =>
new THREE.Vector3(
Math.sin(endAngle) * point.x / Math.sin(PHI_START),
point.y,
Math.cos(endAngle) * point.z / Math.cos(PHI_START)
)
);
for (const points of [edgePoints, oppositeEdgePoints]) {
const curve = new THREE.CatmullRomCurve3(points, false, "centripetal");
const cutEdge = new THREE.Mesh(
new THREE.TubeGeometry(curve, 80, 0.032, 6, false),
edgeMaterial
);
scene.add(cutEdge);
}
// -------------------------------------------------------------------------
// Liquid
// -------------------------------------------------------------------------
const liquidBody = new THREE.Mesh(
new THREE.CylinderGeometry(
1.94,
1.94,
4.38,
72,
1,
true,
PHI_START,
PHI_LENGTH
),
new THREE.MeshPhysicalMaterial({
color: 0xcab66f,
transparent: true,
opacity: 0.105,
roughness: 0.34,
metalness: 0,
side: THREE.DoubleSide,
depthWrite: false
})
);
liquidBody.position.y = 2.7;
liquidBody.renderOrder = 1;
scene.add(liquidBody);
const liquidSurface = new THREE.Mesh(
new THREE.CircleGeometry(1.94, 80),
new THREE.MeshPhysicalMaterial({
color: 0xdac984,
transparent: true,
opacity: 0.34,
roughness: 0.22,
metalness: 0,
side: THREE.DoubleSide,
depthWrite: false
})
);
liquidSurface.rotation.x = -Math.PI / 2;
liquidSurface.position.y = 4.91;
liquidSurface.renderOrder = 3;
scene.add(liquidSurface);
const surfaceRing = new THREE.Mesh(
new THREE.TorusGeometry(1.94, 0.018, 7, 96),
new THREE.MeshBasicMaterial({
color: 0xe8dca5,
transparent: true,
opacity: 0.72,
depthWrite: false
})
);
surfaceRing.rotation.x = Math.PI / 2;
surfaceRing.position.y = 4.915;
surfaceRing.renderOrder = 4;
scene.add(surfaceRing);
// -------------------------------------------------------------------------
// Stylized vegetable forms
// -------------------------------------------------------------------------
let seed = 93721;
function random() {
seed = (seed * 1664525 + 1013904223) >>> 0;
return seed / 4294967296;
}
function range(min, max) {
return min + (max - min) * random();
}
function standardMaterial(color, roughness = 0.72) {
return new THREE.MeshStandardMaterial({
color,
roughness,
metalness: 0,
flatShading: true
});
}
const orangeMaterials = [
standardMaterial(0xdf7836),
standardMaterial(0xee9145),
standardMaterial(0xc9682e)
];
const greenMaterials = [
standardMaterial(0x5f8c43),
standardMaterial(0x76a351),
standardMaterial(0x4f7b3e)
];
const cabbageMaterial = standardMaterial(0xb7ca82);
const cabbageLightMaterial = standardMaterial(0xc9d99b);
const pepperMaterial = standardMaterial(0xc9533d);
const pepperLightMaterial = standardMaterial(0xe4754c);
const seedMaterial = standardMaterial(0xf0e0aa, 0.85);
const carrotGeometry = new THREE.CylinderGeometry(0.39, 0.43, 0.28, 12);
const carrotCapGeometry = new THREE.CircleGeometry(0.31, 12);
const cucumberGeometry = new THREE.CylinderGeometry(0.43, 0.46, 0.25, 14);
const cucumberCapGeometry = new THREE.CircleGeometry(0.35, 14);
const seedGeometry = new THREE.CircleGeometry(0.035, 8);
const cabbageGeometry = new THREE.IcosahedronGeometry(0.47, 1);
const pepperGeometry = new THREE.TorusGeometry(
0.25,
0.105,
6,
14,
Math.PI * 1.55
);
function makeCarrot() {
const group = new THREE.Group();
const body = new THREE.Mesh(
carrotGeometry,
orangeMaterials[Math.floor(random() * orangeMaterials.length)]
);
body.castShadow = true;
body.receiveShadow = true;
group.add(body);
const cap = new THREE.Mesh(
carrotCapGeometry,
standardMaterial(0xf0a252)
);
cap.rotation.x = -Math.PI / 2;
cap.position.y = 0.145;
group.add(cap);
group.rotation.set(range(-0.32, 0.32), range(0, Math.PI), range(-0.38, 0.38));
group.scale.setScalar(range(0.84, 1.12));
return group;
}
function makeCucumber() {
const group = new THREE.Group();
const body = new THREE.Mesh(
cucumberGeometry,
greenMaterials[Math.floor(random() * greenMaterials.length)]
);
body.castShadow = true;
body.receiveShadow = true;
group.add(body);
const cap = new THREE.Mesh(
cucumberCapGeometry,
standardMaterial(0xb9c985)
);
cap.rotation.x = -Math.PI / 2;
cap.position.y = 0.13;
group.add(cap);
for (let i = 0; i < 5; i++) {
const angle = (i / 5) * Math.PI * 2;
const seedMesh = new THREE.Mesh(seedGeometry, seedMaterial);
seedMesh.rotation.x = -Math.PI / 2;
seedMesh.position.set(
Math.cos(angle) * 0.17,
0.136,
Math.sin(angle) * 0.17
);
group.add(seedMesh);
}
group.rotation.set(range(-0.28, 0.28), range(0, Math.PI), range(-0.34, 0.34));
group.scale.setScalar(range(0.86, 1.08));
return group;
}
function makeCabbage() {
const group = new THREE.Group();
const core = new THREE.Mesh(
cabbageGeometry,
Math.random() > 0.5 ? cabbageMaterial : cabbageLightMaterial
);
core.castShadow = true;
core.receiveShadow = true;
core.scale.set(
range(0.85, 1.12),
range(0.72, 0.95),
range(0.85, 1.12)
);
group.add(core);
group.rotation.set(range(0, Math.PI), range(0, Math.PI), range(0, Math.PI));
group.scale.setScalar(range(0.78, 1.0));
return group;
}
function makePepper() {
const group = new THREE.Group();
const strip = new THREE.Mesh(
pepperGeometry,
random() > 0.5 ? pepperMaterial : pepperLightMaterial
);
strip.castShadow = true;
strip.receiveShadow = true;
group.add(strip);
group.rotation.set(range(-1.0, 1.0), range(0, Math.PI * 2), range(-0.9, 0.9));
group.scale.set(range(0.8, 1.2), range(0.75, 1.1), range(0.8, 1.2));
return group;
}
const vegetableGroup = new THREE.Group();
scene.add(vegetableGroup);
function addLayer(y, count, type, offset = 0) {
for (let i = 0; i < count; i++) {
const angle = offset + (i / count) * Math.PI * 2 + range(-0.16, 0.16);
const radius = range(0.7, 1.38);
let vegetable;
if (type === "carrot") vegetable = makeCarrot();
else if (type === "cucumber") vegetable = makeCucumber();
else if (type === "cabbage") vegetable = makeCabbage();
else vegetable = makePepper();
vegetable.position.set(
Math.sin(angle) * radius,
y + range(-0.09, 0.09),
Math.cos(angle) * radius
);
vegetableGroup.add(vegetable);
}
}
addLayer(0.88, 7, "carrot", 0.12);
addLayer(1.38, 6, "cucumber", 0.72);
addLayer(1.88, 5, "cabbage", 0.18);
addLayer(2.37, 7, "pepper", 0.56);
addLayer(2.89, 6, "carrot", 0.08);
addLayer(3.40, 6, "cucumber", 0.64);
addLayer(3.91, 5, "cabbage", 0.22);
addLayer(4.36, 4, "carrot", 0.77);
// -------------------------------------------------------------------------
// Small submerged weight
// -------------------------------------------------------------------------
const weight = new THREE.Group();
weight.position.set(0.43, 4.53, 0.56);
const weightBody = new THREE.Mesh(
new THREE.CylinderGeometry(0.5, 0.57, 0.25, 24),
standardMaterial(0x68736f, 0.48)
);
weightBody.castShadow = true;
weightBody.receiveShadow = true;
weight.add(weightBody);
const weightRim = new THREE.Mesh(
new THREE.TorusGeometry(0.49, 0.045, 8, 36),
standardMaterial(0x87908c, 0.42)
);
weightRim.rotation.x = Math.PI / 2;
weightRim.position.y = 0.03;
weight.add(weightRim);
const weightInset = new THREE.Mesh(
new THREE.CircleGeometry(0.16, 24),
standardMaterial(0x4f5c57, 0.62)
);
weightInset.rotation.x = -Math.PI / 2;
weightInset.position.y = 0.131;
weight.add(weightInset);
scene.add(weight);
// -------------------------------------------------------------------------
// Suspended bubbles
// -------------------------------------------------------------------------
const bubbleMaterial = new THREE.MeshBasicMaterial({
color: 0xf6edcf,
transparent: true,
opacity: 0.52,
depthWrite: false
});
const bubbleGeometry = new THREE.SphereGeometry(1, 10, 8);
const bubbles = [];
for (let i = 0; i < 18; i++) {
const angle = range(0, Math.PI * 2);
const radius = range(0.35, 1.62);
const size = range(0.035, 0.105);
const bubble = new THREE.Mesh(bubbleGeometry, bubbleMaterial);
bubble.position.set(
Math.sin(angle) * radius,
range(0.62, 4.72),
Math.cos(angle) * radius
);
bubble.scale.setScalar(size);
bubble.renderOrder = 4;
bubble.userData.speed = range(0.16, 0.38);
bubble.userData.phase = range(0, Math.PI * 2);
bubbles.push(bubble);
scene.add(bubble);
}
// -------------------------------------------------------------------------
// Camera controls implemented directly without external addons
// -------------------------------------------------------------------------
const target = new THREE.Vector3(0, 2.75, 0);
const orbit = {
radius: 10.4,
theta: 0.64,
phi: 1.12
};
function updateCamera() {
const horizontal = Math.sin(orbit.phi) * orbit.radius;
camera.position.set(
target.x + Math.sin(orbit.theta) * horizontal,
target.y + Math.cos(orbit.phi) * orbit.radius,
target.z + Math.cos(orbit.theta) * horizontal
);
camera.lookAt(target);
}
updateCamera();
const pointers = new Map();
const canvas = renderer.domElement;
canvas.addEventListener("pointerdown", (event) => {
canvas.setPointerCapture(event.pointerId);
pointers.set(event.pointerId, {
x: event.clientX,
y: event.clientY
});
});
canvas.addEventListener("pointermove", (event) => {
if (!pointers.has(event.pointerId)) return;
const previous = pointers.get(event.pointerId);
if (pointers.size === 1) {
const deltaX = event.clientX - previous.x;
const deltaY = event.clientY - previous.y;
orbit.theta -= deltaX * 0.006;
orbit.phi = THREE.MathUtils.clamp(
orbit.phi - deltaY * 0.005,
0.48,
1.43
);
} else if (pointers.size === 2) {
const other = [...pointers.entries()].find(
([id]) => id !== event.pointerId
);
if (other) {
const beforeDistance = Math.hypot(
previous.x - other[1].x,
previous.y - other[1].y
);
const afterDistance = Math.hypot(
event.clientX - other[1].x,
event.clientY - other[1].y
);
if (beforeDistance > 0 && afterDistance > 0) {
orbit.radius = THREE.MathUtils.clamp(
orbit.radius * (beforeDistance / afterDistance),
7.2,
14.5
);
}
}
}
pointers.set(event.pointerId, {
x: event.clientX,
y: event.clientY
});
updateCamera();
});
function releasePointer(event) {
pointers.delete(event.pointerId);
}
canvas.addEventListener("pointerup", releasePointer);
canvas.addEventListener("pointercancel", releasePointer);
canvas.addEventListener("lostpointercapture", releasePointer);
canvas.addEventListener(
"wheel",
(event) => {
event.preventDefault();
orbit.radius = THREE.MathUtils.clamp(
orbit.radius * Math.exp(event.deltaY * 0.001),
7.2,
14.5
);
updateCamera();
},
{ passive: false }
);
// -------------------------------------------------------------------------
// Animation
// -------------------------------------------------------------------------
const clock = new THREE.Clock();
function animate() {
const elapsed = clock.getElapsedTime();
liquidSurface.position.y = 4.91 + Math.sin(elapsed * 1.1) * 0.009;
surfaceRing.position.y = liquidSurface.position.y + 0.005;
weight.position.y = 4.53 + Math.sin(elapsed * 0.9) * 0.014;
weight.rotation.y = Math.sin(elapsed * 0.22) * 0.018;
for (const bubble of bubbles) {
bubble.position.y += bubble.userData.speed * clock.getDelta();
if (bubble.position.y > 4.78) {
bubble.position.y = 0.62;
}
const pulse = 1 + Math.sin(elapsed * 2.2 + bubble.userData.phase) * 0.08;
bubble.scale.x = bubble.scale.z = pulse * bubble.userData.size;
bubble.scale.y = bubble.scale.z * 1.12;
}
renderer.render(scene, camera);
requestAnimationFrame(animate);
}
animate();
window.addEventListener("resize", () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
});
</script>
</body>
</html>
```