Torus Knot
Animated TorusKnotGeometry with standard shading and controls.
What this code does
- TorusKnotGeometry is parametrically generated with p, q parameters internally.
- Rotating the mesh reveals complex topology under directional lighting.
JavaScript (plain)
const scene = new THREE.Scene()
const camera = new THREE.PerspectiveCamera(75, width / height, 0.1, 1000)
const renderer = new THREE.WebGLRenderer({ antialias: true })
renderer.setSize(width, height)
document.querySelector('#app').appendChild(renderer.domElement)
const mesh = new THREE.Mesh(
new THREE.TorusKnotGeometry(0.7, 0.25, 128, 32),
new THREE.MeshStandardMaterial({ color: 0x00aaff })
)
scene.add(mesh)