Start a project

// 3D objects

082 / 112

A mirror-finish torus knot reflecting a studio environment.

Loading…

The code

All of it, in 2 files: the component above, restyle included. The second tab is the small helper it shares with the other WebGL pieces — save both side by side.

"use client";
import * as THREE from "three";
import { ThreeStage, lights } from "./_three";
/** ChromeLogo — a mirror-finish torus knot: metalness 1, low roughness, reflecting a studio environment. Swap the geometry for your own mark (ExtrudeGeometry from an SVG). Needs _three.tsx + three. */
export default function ChromeLogo() {
  return (
    <ThreeStage label="Chrome logo" camZ={4.2} setup={({ scene, pointer, env }) => {
      env(); lights(scene);
      const m = new THREE.Mesh(new THREE.TorusKnotGeometry(0.85, 0.3, 220, 36), new THREE.MeshStandardMaterial({ color: 0xffffff, metalness: 1, roughness: 0.1, envMapIntensity: 1.4 }));
      scene.add(m);
      return { update: (t) => { m.rotation.y += (pointer.x * 1.2 + t * 0.35 - m.rotation.y) * 0.06; m.rotation.x += (pointer.y * 0.8 + 0.3 - m.rotation.x) * 0.06; } };
    }} />
  );
}

15 lines · 849B · ChromeLogo.tsx

Or install it

Published to a shadcn-style registry, so one command fetches the files straight into your project, and adds three.js.

npx shadcn@latest add https://your-domain.com/r/chrome-logo.json

Placeholder domain — set NEXT_PUBLIC_SITE_URL to your deployed origin and the command updates.

// Next up