SVG Path Morpher
Interpolate two SVG paths and generate SMIL or CSS animation code
About
A deterministic browser-based SVG path morphing tool. It accepts M, L, C, Q, and Z commands, converts segments to matching cubic structures, previews interpolation steps, and generates SMIL and CSS animation snippets.
Examples
Midpoint of two lines
interpolatePaths(normalizePaths("M 0 0 L 10 0", "M 10 10 L 20 10").from, normalizePaths("M 0 0 L 10 0", "M 10 10 L 20 10").to, 0.5)"M 5.000 5.000 ..."Start points (0,0) and (10,10) average to (5,5) with three-decimal formatting.
Circle to square
generateSvgAnimation(SVG_MORPH_EXAMPLES.circle, SVG_MORPH_EXAMPLES.square){ smil: "<path ...>", css: "@keyframes svg-path-morph ..." }Four cubic segments normalize on both sides and produce stable SMIL plus CSS output.
About this tool
SVG Path Morpher interpolates between two path strings with normalizePaths(from, to) plus interpolatePaths(from, to, t): parseSvgPath converts M, L, C, Q, and Z commands into cubic segments, pads the shorter side by repeating its last segment, and lerps every coordinate at parameter t.
Closed paths round-trip through Z: a Z command closes the subpath with a cubic back to the subpath start and sets closed true, so interpolated output ends with " Z" whenever either input was closed.
Only the five supported commands parse — anything else (e.g. A arcs) throws "Unsupported SVG path command", and generateSvgAnimation emits deterministic SMIL plus CSS @keyframes svg-path-morph output for the same inputs.
How to use this tool
Provide two paths
Pass path strings starting with M to normalizePaths — mismatched segment counts are padded automatically.
Interpolate at t
Call interpolatePaths with t in [0, 1]; 0.5 gives the exact midpoint of every coordinate.
Keep Z for closed shapes
End closed shapes with Z so circle-to-square morphs stay closed through the animation.
Export the animation
Use generateSvgAnimation for ready-to-paste SMIL values and CSS d: path() keyframes.
Use cases
Animating icon transitions
Morph play-to-pause or circle-to-square icons with matching closed-path keyframes.
Prototyping logo morphs
Preview midpoint shapes between two wordmarks before committing to hand-tuned animation.
Teaching Bézier conversion
Show how lines and quadratics expand into cubics for a shared interpolation space.
Common mistakes
Mistake:Interpolating without normalizing first.
Fix:interpolatePaths throws unless segment counts match — always pass normalizePaths output.
Mistake:Feeding arc (A) commands.
Fix:Arcs are unsupported by design; convert them to C curves in a vector editor first.
Frequently asked questions
What does this tool do?
It morphs SVG shapes with normalizePaths plus interpolatePaths, and exports animations with generateSvgAnimation (SMIL values plus CSS @keyframes svg-path-morph).
What happens with different command counts?
The shorter path is padded by repeating its last cubic segment, so both sides end with equal segment counts before lerping.
Is my artwork uploaded or stored?
No. Path parsing, normalization, and interpolation run fully client-side.
Why did my path throw?
Only M, L, C, Q, and Z parse — arcs (A) throw Unsupported SVG path command, and empty or segment-free paths throw as well.
Related guides
References & standards
Related tools
.env Secret Safety Linter
Validate .env syntax and spot likely leaked credentials or placeholder secrets.
.htaccess Generator
Build an Apache .htaccess — HTTPS redirects, rewrites, error pages, security headers, and basic auth
2D Fluid Dynamics & Particle Physics Sandbox
A physics playground with two engines sharing one canvas. The fluid mode runs a real Eulerian Navier-Stokes solver — semi-Lagrangian advection, explicit diffusion, Jacobi pressure projection and vorticity confinement — that you paint with dye and velocity using mouse or touch. The particle mode is a damped Verlet N-body engine with gravity wells, Coulomb attractors and repulsors, spring links, wall restitution and elastic circle collisions. Particle counts adapt to the device (100k target on WebGL2 desktop, 2k-5k on CPU fallback), and every configuration exports as runnable code: a Matter.js world, a PixiJS ticker setup, or a standalone vanilla Canvas engine.
AI Function Calling Schema Generator
Generate function calling JSON schemas from TypeScript interfaces
Algorithm Arena & Data Structure Visualizer
Interactive arena for algorithms and data structures: eight sorting algorithms racing on one seeded input, six pathfinding algorithms walking generated mazes, and BST, AVL, Red-Black, B-tree, heap and trie operations replayed step by step with rotations highlighted. Every run shows the Big-O table and the phase-highlighted reference implementation in four languages, and compared values can be played as pitch (sonification) through the shared audio engine. Everything runs client-side; inputs never leave the browser.
Ansible Playbook Generator
Build an Ansible playbook — hosts, vars, and tasks with modules — as YAML