Browse by type
An interactive 3D event badge for the web. Grab the card, throw it, swing it or spin it: the lanyard is simulated with real physics, twists when the card spins, turns the card back as it unwinds, and loops through the ring on the card's clip. The card design and the lanyard print are plain image files, so you can make the badge your own without opening any 3D software.
If you find it useful, give this repository a star ⭐
Building an interactive 3D event badge with React Three Fiber
Requires Node.js 20.9 or later.
git clone https://github.com/daffahaidar/interactive-3d-event-badge.git
cd interactive-3d-event-badge
npm install
npm run dev
Open http://localhost:3000 in your browser.
| Command | What it does |
|---|---|
npm run dev |
Start the development server |
npm run build |
Build for production |
npm run start |
Serve the production build |
npm run lint |
Run ESLint |
All assets live in public/assets/:
| File | What it is |
|---|---|
images/card_texture.png |
Card design, front and back |
images/tag_texture.png |
Print on the lanyard band |
3d/card.glb |
Card, ring and hook model |
The included artwork (photo and Digital Infinit branding) is only an example. Replace it with your own.
card_texture.pngOne image holds both sides of the card.
x: 0 540 1080
┌─────────────┬─────────────┐ y: 0
│ │ │
│ FRONT │ BACK │
│ 540 × 815 │ 540 × 815 │
│ │ │
├─────────────┴─────────────┤ y: 815
│ (unused) │
└───────────────────────────┘ y: 1080
| Area | Pixels in a 1080 × 1080 file | Share of the image |
|---|---|---|
| Front | x 0–540, y 0–815 | left 50 %, top 75.5 % |
| Back | x 540–1080, y 0–815 | right 50 %, top 75.5 % |
| Unused | y 815–1080 | bottom 24.5 % |
Each side is 540 × 815 px (about 2:3). Draw both sides upright and unmirrored. The back appears the
way you see it when you turn the card around. The included card_texture.png is a ready-made template.
Tips:
card_texture.png to get a plain white card.The name comes from the name prop in app/page.tsx:
<Band name="Daffa Haidar" />
Remove the prop if your card design already includes the name. The text is white Inter, so it is not
visible on the plain white card. Change its font, color or position in the <Text> element in
components/band.tsx.
tag_texture.png-3 in updateRibbon in components/band.tsx.PRINT_GAP in components/band.tsx is where that gap
sits across the image's width (0 = left edge, 1 = right edge); that spot is kept under the rivet.card.glbcard, clip (the ring) and clamp (the hook), and a material named
metal. The card's own material is defined in code, so the model needs no textures.LOOP in
components/band.tsx). If you replace the model, measure them again, or the band won't sit on the ring.These constants are at the top of components/band.tsx:
| Constant | Default | Effect |
|---|---|---|
HALF_WIDTH |
0.11 |
Half the width of the band |
HALF_THICKNESS |
0.006 |
Half the thickness of the band |
TORSION |
7.5 |
How strongly a twisted band turns the card back |
GRIP |
25 |
How tightly a dragged card follows the pointer |
RIVET_RUN |
0.05 |
Length of the riveted overlap above the ring |
Camera, lights and gravity are set in app/page.tsx.
app/page.tsx Canvas, camera, lights and physics world
components/band.tsx Lanyard band, card, physics joints and torsion
public/assets/ Card model and textures
MIT © Daffa Haidar Nabil Zufar
browse all types & interfaces →
$ claude mcp add interactive-3d-event-badge \
-- python -m otcore.mcp_server <graph>