Prompt specification
Build or customize the Three.js 3D scene "Membrane pore and cargo size model" 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: Membrane pore and cargo size model
Category: Biology & Nature · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/membrane-pore-and-cargo-size-model-x0853
Scene Description Prompt:
Create a standalone low-poly scene in one HTML file using Three.js from cdnjs. Build an enlarged membrane patch with several pores and differently sized particles; show the pore scale as exaggerated and distinguish allowed passage from blocked objects.
Working Three.js Starter (membrane-pore-and-cargo-size-model-x0853):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Low-Poly Membrane Pore Test</title>
<style>
:root {
color-scheme: dark;
font-family: Inter, ui-sans-serif, system-ui, -apple-system,
BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background:
radial-gradient(circle at 48% 38%, #17384b 0%, #0b1c2a 46%, #050b13 100%);
}
#scene {
position: fixed;
inset: 0;
}
#scene canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
outline: none;
}
.hud {
position: fixed;
z-index: 10;
pointer-events: none;
color: #e9fbff;
}
.title-card {
top: 28px;
left: 30px;
max-width: 430px;
}
.eyebrow {
margin-bottom: 9px;
color: #72e7df;
font-size: 11px;
font-weight: 800;
letter-spacing: 0.22em;
text-transform: uppercase;
}
h1 {
margin: 0;
font-size: clamp(28px, 4vw, 48px);
font-weight: 760;
line-height: 0.98;
letter-spacing: -0.045em;
text-shadow: 0 4px 24px rgba(0, 0, 0, 0.32);
}
.subtitle {
max-width: 350px;
margin: 13px 0 0;
color: #abc4d1;
font-size: 14px;
line-height: 1.55;
}
.panel {
border: 1px solid rgba(164, 225, 238, 0.16);
border-radius: 16px;
background: linear-gradient(
145deg,
rgba(11, 27, 40, 0.86),
rgba(7, 18, 29, 0.72)
);
box-shadow:
0 18px 50px rgba(0, 0, 0, 0.25),
inset 0 1px rgba(255, 255, 255, 0.04);
backdrop-filter: blur(12px);
}
.legend {
top: 28px;
right: 28px;
width: 250px;
padding: 18px;
}
.panel-heading {
margin-bottom: 15px;
color: #89a6b5;
font-size: 10px;
font-weight: 800;
letter-spacing: 0.19em;
text-transform: uppercase;
}
.legend-row {
display: flex;
align-items: center;
gap: 11px;
margin: 13px 0;
}
.swatch {
position: relative;
flex: 0 0 auto;
width: 22px;
height: 22px;
border-radius: 50%;
}
.swatch.allowed {
background: #61f0dd;
box-shadow:
0 0 0 4px rgba(97, 240, 221, 0.09),
0 0 18px rgba(97, 240, 221, 0.34);
}
.swatch.blocked {
background: #ff735f;
box-shadow:
0 0 0 4px rgba(255, 115, 95, 0.09),
0 0 18px rgba(255, 115, 95, 0.3);
}
.legend-row b {
display: block;
color: #e9fbff;
font-size: 13px;
}
.legend-row small {
display: block;
margin-top: 2px;
color: #8da8b6;
font-size: 11px;
}
.scale-chip {
margin-top: 17px;
padding: 9px 10px;
border: 1px solid rgba(114, 231, 223, 0.22);
border-radius: 9px;
background: rgba(67, 207, 198, 0.07);
color: #82e9e1;
font-size: 10px;
font-weight: 800;
letter-spacing: 0.12em;
text-align: center;
}
.stats {
display: flex;
justify-content: space-between;
margin-top: 14px;
padding-top: 13px;
border-top: 1px solid rgba(164, 225, 238, 0.11);
color: #7894a3;
font-size: 10px;
text-transform: uppercase;
letter-spacing: 0.08em;
}
.stats b {
display: block;
margin-bottom: 2px;
color: #e9fbff;
font-size: 17px;
letter-spacing: 0;
}
.controls {
bottom: 24px;
left: 50%;
width: max-content;
max-width: calc(100vw - 32px);
padding: 10px 15px;
transform: translateX(-50%);
border: 1px solid rgba(164, 225, 238, 0.12);
border-radius: 999px;
background: rgba(6, 15, 24, 0.72);
color: #91aab8;
font-size: 11px;
letter-spacing: 0.02em;
text-align: center;
backdrop-filter: blur(10px);
}
.controls b {
color: #d9f8ff;
font-weight: 650;
}
@media (max-width: 720px) {
.title-card {
top: 20px;
left: 20px;
}
.subtitle {
display: none;
}
.legend {
top: auto;
right: 16px;
bottom: 66px;
width: 205px;
padding: 13px;
}
.legend-row {
margin: 9px 0;
}
.stats {
display: none;
}
.scale-chip {
margin-top: 11px;
}
.controls {
bottom: 16px;
font-size: 10px;
}
}
</style>
</head>
<body>
<main id="scene"></main>
<section class="hud title-card">
<div class="eyebrow">Low-poly molecular study</div>
<h1>Selective<br>permeability</h1>
<p class="subtitle">
Enlarged membrane pores reveal which particles fit through
and which remain blocked.
</p>
</section>
<aside class="hud panel legend">
<div class="panel-heading">Particle test</div>
<div class="legend-row">
<span class="swatch allowed"></span>
<div>
<b>Allowed passage</b>
<small>Particle fits through the pore</small>
</div>
</div>
<div class="legend-row">
<span class="swatch blocked"></span>
<div>
<b>Blocked</b>
<small>Too large for the opening</small>
</div>
</div>
<div class="scale-chip">PORE VIEW · EXAGGERATED</div>
<div class="stats">
<div><b id="poreCount">5</b>pores</div>
<div><b id="particleCount">6</b>particles</div>
</div>
</aside>
<div class="hud controls">
<b>Drag</b> to orbit · <b>Scroll / pinch</b> to zoom ·
<b>Shift-drag / right-drag</b> to pan
</div>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const host = document.querySelector("#scene");
// ------------------------------------------------------------
// Renderer, camera and scene
// ------------------------------------------------------------
const renderer = new THREE.WebGLRenderer({
antialias: true,
alpha: true,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setClearColor(0x000000, 0);
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.12;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.domElement.setAttribute(
"aria-label",
"Interactive low-poly membrane with pores and passing or blocked particles"
);
host.appendChild(renderer.domElement);
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(
42,
window.innerWidth / window.innerHeight,
0.1,
80
);
const orbit = {
theta: 0.72,
phi: 0.88,
radius: 14.2,
target: new THREE.Vector3(0, -0.35, 0)
};
function updateCamera() {
const sinPhi = Math.sin(orbit.phi);
const cosPhi = Math.cos(orbit.phi);
camera.position.set(
orbit.target.x + orbit.radius * sinPhi * Math.sin(orbit.theta),
orbit.target.y + orbit.radius * cosPhi,
orbit.target.z + orbit.radius * sinPhi * Math.cos(orbit.theta)
);
camera.lookAt(orbit.target);
}
updateCamera();
// ------------------------------------------------------------
// Lighting
// ------------------------------------------------------------
scene.add(new THREE.HemisphereLight(0x9fefff, 0x101321, 1.65));
const keyLight = new THREE.DirectionalLight(0xe7fbff, 3.4);
keyLight.position.set(4.5, 10, 6);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(2048, 2048);
keyLight.shadow.camera.left = -10;
keyLight.shadow.camera.right = 10;
keyLight.shadow.camera.top = 9;
keyLight.shadow.camera.bottom = -9;
keyLight.shadow.camera.near = 0.5;
keyLight.shadow.camera.far = 30;
keyLight.shadow.bias = -0.0006;
scene.add(keyLight);
const cyanLight = new THREE.PointLight(0x37e6d6, 22, 12, 2);
cyanLight.position.set(-4, 2.2, 3);
scene.add(cyanLight);
const blueLight = new THREE.PointLight(0x5598ff, 18, 11, 2);
blueLight.position.set(5, 1, -3);
scene.add(blueLight);
const underLight = new THREE.PointLight(0x22c7ca, 15, 9, 2);
underLight.position.set(0, -2.1, 0);
scene.add(underLight);
// ------------------------------------------------------------
// Lower stage
// ------------------------------------------------------------
const ground = new THREE.Mesh(
new THREE.PlaneGeometry(30, 30),
new THREE.MeshStandardMaterial({
color: 0x071622,
roughness: 1,
metalness: 0
})
);
ground.rotation.x = -Math.PI / 2;
ground.position.y = -2.65;
ground.receiveShadow = true;
scene.add(ground);
const grid = new THREE.GridHelper(
24,
24,
0x376a77,
0x183541
);
grid.position.y = -2.63;
grid.material.transparent = true;
grid.material.opacity = 0.3;
scene.add(grid);
// ------------------------------------------------------------
// Membrane shape and pores
// ------------------------------------------------------------
const pores = [
{ x: -3.65, z: -1.65, r: 0.68 },
{ x: 0.05, z: -1.35, r: 0.86 },
{ x: 3.55, z: 1.55, r: 0.74 },
{ x: 1.05, z: 2.45, r: 0.72 },
{ x: -2.35, z: 2.10, r: 0.84 }
];
const outerShape = [
[-6.0, -3.5],
[-5.4, -4.1],
[4.7, -3.8],
[6.0, -2.4],
[5.7, 3.6],
[3.8, 4.0],
[-5.3, 3.7],
[-6.0, 2.2]
];
const membraneShape = new THREE.Shape();
membraneShape.moveTo(outerShape[0][0], outerShape[0][1]);
for (let i = 1; i < outerShape.length; i++) {
membraneShape.lineTo(outerShape[i][0], outerShape[i][1]);
}
membraneShape.closePath();
for (const pore of pores) {
const hole = new THREE.Path();
// The shape is rotated into the XZ plane, so world Z is negated.
hole.absarc(
pore.x,
-pore.z,
pore.r,
0,
Math.PI * 2,
true
);
membraneShape.holes.push(hole);
}
const membraneGeometry = new THREE.ExtrudeGeometry(membraneShape, {
depth: 0.65,
bevelEnabled: false,
steps: 1,
curveSegments: 12
});
membraneGeometry.rotateX(-Math.PI / 2);
membraneGeometry.translate(0, -0.65, 0);
const membraneTopMaterial = new THREE.MeshStandardMaterial({
color: 0x287f86,
roughness: 0.76,
metalness: 0.04,
flatShading: true
});
const membraneSideMaterial = new THREE.MeshStandardMaterial({
color: 0x174d60,
roughness: 0.88,
metalness: 0.02,
flatShading: true
});
const membrane = new THREE.Mesh(
membraneGeometry,
[membraneTopMaterial, membraneSideMaterial]
);
membrane.castShadow = true;
membrane.receiveShadow = true;
scene.add(membrane);
// Faceted edge lines make the membrane thickness easier to read.
function addEdgeLine(y, color, opacity) {
const points = outerShape.map(
([x, shapeY]) => new THREE.Vector3(x, y, -shapeY)
);
const line = new THREE.LineLoop(
new THREE.BufferGeometry().setFromPoints(points),
new THREE.LineBasicMaterial({
color,
transparent: true,
opacity
})
);
scene.add(line);
}
addEdgeLine(0.015, 0x7de8df, 0.82);
addEdgeLine(-0.22, 0x4aa2aa, 0.32);
addEdgeLine(-0.43, 0x4aa2aa, 0.22);
addEdgeLine(-0.63, 0x4aa2aa, 0.14);
// Low-poly cyan rims emphasize the exaggerated openings.
const rimMaterial = new THREE.MeshStandardMaterial({
color: 0x76e8df,
emissive: 0x176c6c,
emissiveIntensity: 0.45,
roughness: 0.42,
metalness: 0.05
});
for (const pore of pores) {
const rim = new THREE.Mesh(
new THREE.TorusGeometry(pore.r + 0.025, 0.035, 6, 28),
rimMaterial
);
rim.rotation.x = Math.PI / 2;
rim.position.set(pore.x, 0.035, pore.z);
rim.castShadow = true;
scene.add(rim);
}
// ------------------------------------------------------------
// Scene labels
// ------------------------------------------------------------
function roundedRect(ctx, x, y, width, height, radius) {
ctx.beginPath();
ctx.moveTo(x + radius, y);
ctx.lineTo(x + width - radius, y);
ctx.quadraticCurveTo(x + width, y, x + width, y + radius);
ctx.lineTo(x + width, y + height - radius);
ctx.quadraticCurveTo(
x + width,
y + height,
x + width - radius,
y + height
);
ctx.lineTo(x + radius, y + height);
ctx.quadraticCurveTo(x, y + height, x, y + height - radius);
ctx.lineTo(x, y + radius);
ctx.quadraticCurveTo(x, y, x + radius, y);
ctx.closePath();
}
function makeLabel(text, color, position) {
const canvas = document.createElement("canvas");
canvas.width = 512;
canvas.height = 160;
const ctx = canvas.getContext("2d");
const hex = `#${color.toString(16).padStart(6, "0")}`;
ctx.clearRect(0, 0, canvas.width, canvas.height);
roundedRect(ctx, 12, 18, 488, 124, 30);
ctx.fillStyle = "rgba(5, 15, 24, 0.90)";
ctx.fill();
ctx.lineWidth = 5;
ctx.strokeStyle = hex;
ctx.stroke();
ctx.fillStyle = hex;
ctx.font = "800 48px system-ui, sans-serif";
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillText(text, 256, 82);
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
const sprite = new THREE.Sprite(
new THREE.SpriteMaterial({
map: texture,
transparent: true,
depthTest: false,
depthWrite: false
})
);
sprite.position.copy(position);
sprite.scale.set(2.4, 0.75, 1);
sprite.renderOrder = 20;
scene.add(sprite);
return sprite;
}
// ------------------------------------------------------------
// Particle geometry and materials
// ------------------------------------------------------------
function particleGeometry(type) {
switch (type) {
case "octa":
return new THREE.OctahedronGeometry(1, 0);
case "tetra":
return new THREE.TetrahedronGeometry(1, 0);
case "dodeca":
return new THREE.DodecahedronGeometry(1, 0);
case "box":
return new THREE.BoxGeometry(2, 2, 2);
default:
return new THREE.IcosahedronGeometry(1, 0);
}
}
function makeParticle({
type = "ico",
size,
color,
emissive = 0.18
}) {
const material = new THREE.MeshStandardMaterial({
color,
emissive: color,
emissiveIntensity: emissive,
roughness: 0.34,
metalness: 0.06,
flatShading: true,
transparent: true,
opacity: 1
});
const mesh = new THREE.Mesh(particleGeometry(type), material);
mesh.scale.setScalar(size);
mesh.castShadow = true;
mesh.receiveShadow = true;
scene.add(mesh);
return mesh;
}
// ------------------------------------------------------------
// Allowed particles: animated down through the membrane
// ------------------------------------------------------------
const allowedParticles = [];
const allowedSpecs = [
{
pore: pores[0],
size: 0.21,
color: 0x61f0dd,
type: "ico",
speed: 0.205,
phase: 0.06
},
{
pore: pores[1],
size: 0.33,
color: 0x55c9ff,
type: "octa",
speed: 0.16,
phase: 0.44
},
{
pore: pores[2],
size: 0.27,
color: 0x9af4c7,
type: "tetra",
speed: 0.235,
phase: 0.73
}
];
const pathMaterial = new THREE.LineDashedMaterial({
color: 0x61f0dd,
dashSize: 0.13,
gapSize: 0.10,
transparent: true,
opacity: 0.3
});
for (const spec of allowedSpecs) {
const { pore } = spec;
const line = new THREE.Line(
new THREE.BufferGeometry().setFromPoints([
new THREE.Vector3(pore.x, 3.75, pore.z),
new THREE.Vector3(pore.x, -2.25, pore.z)
]),
pathMaterial
);
line.computeLineDistances();
scene.add(line);
const arrow = new THREE.Mesh(
new THREE.ConeGeometry(0.085, 0.24, 6),
new THREE.MeshBasicMaterial({
color: spec.color,
transparent: true,
opacity: 0.75
})
);
arrow.rotation.z = Math.PI;
arrow.position.set(pore.x, 3.38, pore.z);
scene.add(arrow);
const mesh = makeParticle(spec);
allowedParticles.push({
...spec,
mesh,
arrow
});
}
// ------------------------------------------------------------
// Blocked particles: rest on top of the membrane
// ------------------------------------------------------------
const blockedParticles = [];
const blockedSpecs = [
{
x: pores[3].x,
z: pores[3].z,
size: 0.96,
color: 0xff735f,
type: "ico",
phase: 0.3
},
{
x: pores[4].x,
z: pores[4].z,
size: 1.08,
color: 0xffa25f,
type: "box",
phase: 1.4
},
{
x: 4.65,
z: -1.8,
size: 0.58,
color: 0xeb526d,
type: "dodeca",
phase: 2.3
}
];
for (const spec of blockedSpecs) {
const mesh = makeParticle(spec);
mesh.position.set(
spec.x,
spec.size + 0.035,
spec.z
);
mesh.rotation.set(
spec.phase * 0.11,
spec.phase * 0.37,
spec.phase * 0.07
);
const halo = new THREE.Mesh(
new THREE.RingGeometry(
spec.size * 1.08,
spec.size * 1.23,
32
),
new THREE.MeshBasicMaterial({
color: spec.color,
transparent: true,
opacity: 0.42,
side: THREE.DoubleSide,
depthWrite: false
})
);
halo.rotation.x = -Math.PI / 2;
halo.position.set(spec.x, 0.055, spec.z);
halo.renderOrder = 5;
scene.add(halo);
blockedParticles.push({
...spec,
mesh,
halo,
baseRotation: mesh.rotation.clone()
});
}
// In-world labels
makeLabel(
"PASSES",
0x61f0dd,
new THREE.Vector3(pores[0].x, 2.15, pores[0].z)
);
makeLabel(
"BLOCKED",
0xff735f,
new THREE.Vector3(pores[3].x, 2.05, pores[3].z)
);
document.querySelector("#poreCount").textContent = pores.length;
document.querySelector("#particleCount").textContent =
allowedParticles.length + blockedParticles.length;
// ------------------------------------------------------------
// Custom camera controls: orbit, zoom and pan
// ------------------------------------------------------------
const canvas = renderer.domElement;
const pointers = new Map();
let gesturePointer = null;
let lastX = 0;
let lastY = 0;
let panGesture = false;
let pinchDistance = 0;
function pointerDistance() {
const values = [...pointers.values()];
if (values.length < 2) return 0;
return Math.hypot(
values[0].x - values[1].x,
values[0].y - values[1].y
);
}
canvas.addEventListener("pointerdown", (event) => {
canvas.setPointerCapture(event.pointerId);
pointers.set(event.pointerId, {
x: event.clientX,
y: event.clientY
});
if (pointers.size === 1) {
gesturePointer = event.pointerId;
lastX = event.clientX;
lastY = event.clientY;
panGesture = event.button === 2 || event.shiftKey;
} else if (pointers.size === 2) {
pinchDistance = pointerDistance();
}
});
canvas.addEventListener("pointermove", (event) => {
if (!pointers.has(event.pointerId)) return;
pointers.set(event.pointerId, {
x: event.clientX,
y: event.clientY
});
if (pointers.size >= 2) {
const nextDistance = pointerDistance();
if (pinchDistance > 0 && nextDistance > 0) {
orbit.radius = THREE.MathUtils.clamp(
orbit.radius * (pinchDistance / nextDistance),
6.5,
23
);
}
pinchDistance = nextDistance;
updateCamera();
return;
}
if (event.pointerId !== gesturePointer) return;
const dx = event.clientX - lastX;
const dy = event.clientY - lastY;
lastX = event.clientX;
lastY = event.clientY;
if (event.shiftKey) panGesture = true;
if (panGesture) {
const forward = new THREE.Vector3()
.subVectors(orbit.target, camera.position)
.normalize();
const right = new THREE.Vector3()
.crossVectors(forward, camera.up)
.normalize();
const up = new THREE.Vector3()
.crossVectors(right, forward)
.normalize();
const panScale = orbit.radius * 0.00125;
orbit.target.addScaledVector(right, -dx * panScale);
orbit.target.addScaledVector(up, dy * panScale);
orbit.target.x = THREE.MathUtils.clamp(
orbit.target.x, -5, 5
);
orbit.target.y = THREE.MathUtils.clamp(
orbit.target.y, -1.5, 1.5
);
orbit.target.z = THREE.MathUtils.clamp(
orbit.target.z, -4, 4
);
} else {
orbit.theta -= dx * 0.006;
orbit.phi = THREE.MathUtils.clamp(
orbit.phi + dy * 0.005,
0.27,
1.42
);
}
updateCamera();
});
function endPointer(event) {
pointers.delete(event.pointerId);
if (pointers.size === 0) {
gesturePointer = null;
pinchDistance = 0;
} else if (pointers.size === 1) {
const remaining = [...pointers.entries()][0];
gesturePointer = remaining[0];
lastX = remaining[1].x;
lastY = remaining[1].y;
panGesture = false;
pinchDistance = 0;
}
}
canvas.addEventListener("pointerup", endPointer);
canvas.addEventListener("pointercancel", endPointer);
canvas.addEventListener("contextmenu", (event) => {
event.preventDefault();
});
canvas.addEventListener(
"wheel",
(event) => {
event.preventDefault();
orbit.radius = THREE.MathUtils.clamp(
orbit.radius * Math.exp(event.deltaY * 0.001),
6.5,
23
);
updateCamera();
},
{ passive: false }
);
// ------------------------------------------------------------
// Animation
// ------------------------------------------------------------
const clock = new THREE.Clock();
function animate() {
requestAnimationFrame(animate);
const time = clock.getElapsedTime();
// Allowed particles travel from above the membrane to below it.
for (const particle of allowedParticles) {
const progress =
(time * particle.speed + particle.phase) % 1;
const startY = 3.65;
const endY = -2.25;
particle.mesh.position.set(
particle.pore.x +
Math.sin(time * 2.2 + particle.phase * 8) * 0.025,
THREE.MathUtils.lerp(startY, endY, progress),
particle.pore.z +
Math.cos(time * 1.8 + particle.phase * 7) * 0.025
);
particle.mesh.rotation.x += 0.012;
particle.mesh.rotation.y += 0.017;
// Fade near the loop boundaries so particles do not pop.
particle.mesh.material.opacity = Math.min(
1,
progress * 11,
(1 - progress) * 11
);
particle.arrow.material.opacity =
0.55 + Math.sin(time * 3 + particle.phase * 5) * 0.15;
}
// Blocked particles rock slightly while remaining on top.
for (const particle of blockedParticles) {
particle.mesh.rotation.z =
particle.baseRotation.z +
Math.sin(time * 0.8 + particle.phase) * 0.035;
particle.mesh.rotation.x =
particle.baseRotation.x +
Math.cos(time * 0.65 + particle.phase) * 0.02;
const pulse = 1 + Math.sin(time * 2.2 + particle.phase) * 0.055;
particle.halo.scale.setScalar(pulse);
particle.halo.material.opacity =
0.34 + Math.sin(time * 2.2 + particle.phase) * 0.1;
}
renderer.render(scene, camera);
}
animate();
// ------------------------------------------------------------
// Resize
// ------------------------------------------------------------
window.addEventListener("resize", () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
});
</script>
</body>
</html>
```