explaingit

gordensun/cad-power-animations

19JavaScriptAudience · designerComplexity · 3/5Setup · moderate

TLDR

A website that shows animated 3D models of mechanical systems, like a car engine and bicycle drivetrain, so you can see exactly how power flows from one moving part to the next.

Mindmap

mindmap
  root((repo))
    Models
      F1 engine cutaway
      Bicycle drivetrain
    Toolchain
      Python build123d
      STEP file output
      GLB mesh output
    Viewer
      three.js renderer
      Animation sidecars
      GitHub Pages host
    Workflow
      Add Python model
      Generate GLB file
      Write animation script
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Explore interactive 3D animations of a four-cylinder F1 engine or bicycle drivetrain to understand how mechanical power travels through each part.

USE CASE 2

Add your own CAD model by writing a Python build123d file, generating a GLB, and creating an animation sidecar to show part movement.

USE CASE 3

Use the project as a template for publishing interactive 3D mechanical visualizations as a static GitHub Pages site with no server required.

USE CASE 4

Study the 500-line three.js viewer to learn how to load GLB files and animate named part groups in a web browser.

Tech stack

JavaScriptPythonthree.jsbuild123dGitHub Actions

Getting it running

Difficulty · moderate Time to first run · 30min

Requires Python with build123d installed to create or modify models, viewing the existing site needs no local setup.

In plain English

CAD Power Animations is a project that builds animated, interactive 3D models of mechanical systems and publishes them as a static website on GitHub Pages. The goal is to show how power physically travels through a real machine: which part moves first, which moves because of that, and so on. Two models are currently in the repository: a cut-away four-cylinder engine from an F1 race car (pistons to crank to drive shaft to differential to rear wheels), and a bicycle drivetrain (pedals to chainring to chain to rear cog to rear wheel). The models are created in Python using a library called build123d, which lets you define 3D geometry with code and parameterize it. From the Python source, the workflow produces a STEP file (a standard CAD exchange format) and a GLB file (a 3D mesh format that web browsers can load). Each model also has a small JavaScript sidecar file that defines the animation: which parts move, how they move relative to each other, and at what rate. This sidecar file runs both in a local CAD viewer during development and in the public website. The viewer itself is a hand-rolled three.js page at about 500 lines of code. It loads the GLB mesh, maps each physical part to a named group, and runs the animation sidecar every frame to apply transforms and colors based on the current time or parameter values. The landing page shows cards for each available model, and clicking one opens the viewer for that model. Deployment is handled by a GitHub Actions workflow that copies the model files and site assets into a bundle and publishes it to GitHub Pages on every push to the main branch. Adding a new model requires writing a Python file that returns a labeled 3D compound, generating the STEP and GLB files, writing the animation sidecar, adding a thumbnail, and registering the model in the viewer config.

Copy-paste prompts

Prompt 1
I want to add a new mechanical model to cad-power-animations. Walk me through writing the Python build123d file, generating the GLB, and creating the animation sidecar.
Prompt 2
Show me how the animation sidecar format works in cad-power-animations so I can define which parts rotate and at what speed relative to each other.
Prompt 3
How does the three.js viewer in cad-power-animations map GLB part names to animated groups? Show me how to modify colors or transform speeds.
Prompt 4
I want to fork cad-power-animations and publish my own 3D model site on GitHub Pages. What are the minimum steps to replace the existing models with mine?
Prompt 5
Explain the build123d to GLB workflow in cad-power-animations, how does a Python geometry definition become a file the browser can animate?
Open on GitHub → Explain another repo

← gordensun on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.