Code

Three.js

Animation

Intermediate Three objects animating independently — rotation, vertical sine-wave oscillation, and pulse scaling driven by requestAnimationFrame. Three.js Docs

const meshes = [
  new THREE.Mesh(
    new THREE.TorusKnotGeometry(0.42, 0.15, 100, 16),
    new THREE.MeshNormalMaterial()
  ),
  new THREE.Mesh(
    new THREE.OctahedronGeometry(0.6),
    new THREE.MeshNormalMaterial()
  ),
  new THREE.Mesh(
    new THREE.IcosahedronGeometry(0.5, 1),
    new THREE.MeshNormalMaterial()
  ),
];

meshes.forEach((m, i) => {
  m.position.x = (i - 1) * 2;
  scene.add(m);
});

let t = 0;
function animate() {
  t += 0.012;
  meshes.forEach((m, i) => {
    // spin at different rates
    m.rotation.x = t * (0.5 + i * 0.2);
    m.rotation.y = t * (0.8 + i * 0.3);
    // vertical oscillation
    m.position.y = Math.sin(t + (i * Math.PI * 2) / 3) * 0.5;
    // pulse scale
    m.scale.setScalar(1 + Math.sin(t * 1.5 + i) * 0.15);
  });
  renderer.render(scene, camera);
  requestAnimationFrame(animate);
}