SVG Path Morpher
Interpolate two SVG paths and generate SMIL or CSS animation code
Path data
1 line · 121 chars · 1 line · 33 charsInterpolated path
4 cubic segments · 1 sub-pathExamples
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.
.gitattributes Generator
Build .gitattributes rules for line endings, Git LFS, GitHub linguist marks and merge drivers — with a one-line explanation for every rule.
.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.
A/B Test Sample Size Calculator
Compute required sample size per variant and test duration from baseline conversion rate, minimum detectable effect, alpha and power.
ABA Routing Number Validator
Validate 9-digit US ABA routing numbers with 3-7-1 Mod-10 breakdown.