One shape turns into another by sliding every point of its surface along a straight line to its place in the other shape. Each row of buttons is one mesh that can be laid out several ways: pick a shape in the row on screen and it morphs into it, pick one from another row and that mesh is loaded. Drag to turn it, scroll or pinch to zoom, right-drag to move it. The slider scrubs the last morph.
Loading three.js. If this note stays, the browser could not load or start it (WebGL may be switched off: Settings > System > "Use graphics acceleration when available").
A morph needs the same mesh in two positions: the faces never change, only the places of the points, so the picture is simply every point moving from where it is in the first shape to where it is in the second. That is all a VRML CoordinateInterpolator does. Each row of buttons is one mesh, so a shape can only join a row if it can be laid out on that row's mesh. The sliding is lib/larsi.org/three/morph.js, the layouts of the rows are in morphs.js, and the Earth grid has a helper of its own.
The first row is the cube of my 2003 VRML demos, 8 corners, 12 edge midpoints and 6 face centers with the faces cut into triangles around their centers, here cut finer so it can also be a sphere: the octahedron takes the face centers to its corners and the corners to the middles of its faces, the star pulls the 8 corners halfway in, and the sphere pushes the cube out with the mapping that keeps the squares nearly equal.
The second row is one grid of points, 96 around and 48 rows, with the Earth's picture on it. It is built by lib/larsi.org/geometry/ring-grid.js, which does three small things:
ringGrid(n, m) makes the faces: n points round, rows 0 to m, a quad between neighboring rows. Row 0 and row m may be a ring of points lying on top of each other, which is a pole.ringGridUV(n, m) makes the texture coordinates, laid out like a world map (u east, v up), so the same picture fits every shape.ringShape(kind, n, m, opts) gives the points of that grid laid out as one shape: 'sphere', 'torus', 'cylinder', 'flat', 'lemon' or 'knot'. The grid and the faces are always the same, only this list of points changes, and a morph slides from one list to another.What can join the row is anything that runs from one pole to the other, so that rows 0 and m are single points (or a ring that can open out, like the torus's inner ring):
PROCEDURAL.curvePath() that the Procedural Shapes page sweeps a circle along, which is why the two pages show the same knots.Shapes with an open edge or a shape that does not end in two points do not fit: the vase has an open lip, and the Moebius strip, shell, spring, tentacle and column are swept on other meshes, so they stay on the Procedural Shapes page.
The third row is the scan of my head and the same points each moved to the same distance from the middle, the texture still on it. The fourth row is the dodecahedron and the icosahedron, which are duals of each other: one mesh of 60 points, a point for every corner of every face, joined as 12 pentagons, 20 triangles and 30 squares. The pentagons are whole in the dodecahedron (the triangles are single points), the triangles are whole in the icosahedron (the pentagons are points), and half way between, both are whole in the icosidodecahedron; the squares always lie flat along the edges. The sphere is those points pushed out, on a finer mesh. The last three rows cut the corners off a solid: every corner is pulled apart into one point per edge, and the points slide to the middles of the edges, so a tetrahedron becomes an octahedron, and a cube and an octahedron both become a cuboctahedron. Each of those solids is its own mesh, which is why the cube and the octahedron have a row each.
This page was created with Claude Code.