WorldCup
threecn/world-cupFreeComponent
The World Cup trophy modeled procedurally: two sculpted figures with raised arms lift a continent-embossed globe above a green-banded base, turning under studio light amid a drift of confetti.
Install it
npx shadcn@latest add https://threecn.dev/r/world-cup.jsonSource
1"use client"23import * as React from "react"4import { useFrame } from "@react-three/fiber"5import { Environment, Lightformer } from "@react-three/drei"6import * as THREE from "three"78import {9 SceneContainer,10 type SceneContainerProps,11} from "@/components/threecn/scene-container"12import {13 useShadcnTheme,14 type ThemeMode,15} from "@/components/hooks/use-shadcn-theme"1617/* ------------------------------------------------------------------ */18/* Proportions (scene units). The real trophy: a draped column pinched */19/* at the waist, two figures with raised arms, a globe resting in the */20/* upstretched hands, all on a stepped base with two green bands. */21/* ------------------------------------------------------------------ */2223const GLOBE_R = 0.6224const GLOBE_Y = 2.45 // globe center; its lower third nests into the hands25const BODY_TOP = 2.0526/** Vertical shift so the whole piece sits centered on the origin. */27const CENTER_Y = -1.282829/**30 * Silhouette of the body as (radius, height) control points, bottom to top:31 * a draped skirt narrowing to the waist, then swelling through the figures'32 * chests and opening where the arms rise to meet the globe.33 */34const PROFILE: [number, number][] = [35 [0.45, 0.0],36 [0.36, 0.1],37 [0.29, 0.28],38 [0.24, 0.52],39 [0.215, 0.85], // waist40 [0.24, 1.15],41 [0.3, 1.4],42 [0.38, 1.62],43 [0.45, 1.8],44 [0.49, 1.95],45 [0.45, BODY_TOP], // curls back in right under the globe46]4748const BODY_ROWS = 20049const BODY_COLS = 1605051/* ----------------------------- noise ------------------------------ */5253function hash3(x: number, y: number, z: number) {54 const s = Math.sin(x * 127.1 + y * 311.7 + z * 74.7) * 43758.545355 return s - Math.floor(s)56}5758/** Trilinear value noise in [0, 1]. */59function vnoise3(x: number, y: number, z: number) {60 const ix = Math.floor(x)61 const iy = Math.floor(y)62 const iz = Math.floor(z)63 const fx = x - ix64 const fy = y - iy65 const fz = z - iz66 const ux = fx * fx * (3 - 2 * fx)67 const uy = fy * fy * (3 - 2 * fy)68 const uz = fz * fz * (3 - 2 * fz)69 const lerp = (a: number, b: number, t: number) => a + (b - a) * t70 const c00 = lerp(hash3(ix, iy, iz), hash3(ix + 1, iy, iz), ux)71 const c10 = lerp(hash3(ix, iy + 1, iz), hash3(ix + 1, iy + 1, iz), ux)72 const c01 = lerp(hash3(ix, iy, iz + 1), hash3(ix + 1, iy, iz + 1), ux)73 const c11 = lerp(hash3(ix, iy + 1, iz + 1), hash3(ix + 1, iy + 1, iz + 1), ux)74 return lerp(lerp(c00, c10, uy), lerp(c01, c11, uy), uz)75}7677// … truncated
What it pulls in
npm packages
Files it writes
More from threecn
All 28 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| AuroraRibbonsaurora-ribbons | threecn | Components | Free | 3 deps · 3 files | |
| Boidsboids | threecn | Components | Free | 3 deps · 3 files | |
| Clothcloth | threecn | Components | Free | 3 deps · 3 files | |
| Crystalcrystal | threecn | Components | Free | 3 deps · 3 files | |
| CubeWavecube-wave | threecn | Components | Free | 3 deps · 3 files | |
| CurlFlowcurl-flow | threecn | Components | Free | 3 deps · 3 files | |
| DnaHelixdna-helix | threecn | Components | Free | 3 deps · 3 files | |
| FloatingCard3Dfloating-card-3d | threecn | Components | Free | 3 deps · 3 files |
