SVG

MorphSVG

MorphSVG is a GSAP plugin that tweens one SVG shape into another by animating the path's `d` attribute. The start and end shapes don't need the same number of points, the plugin converts both to cubic beziers and adds points where it needs them, so you can morph a play icon into a pause bar or a circle into a checkmark with a single tween.

Updated June 30, 2026

Mechanics

How MorphSVG works

You register MorphSVGPlugin, then put morphSVG in the vars of a normal gsap.to(). The value is the shape you want to end on, given as a selector, an element, or a raw path-data string. GSAP reads the d attribute of the start path and the target, matches up segments, and interpolates the anchor and control points frame by frame so the outline flows from one form to the other.

icon-morph.js

MorphSVG tweens <path>, <polyline>, and <polygon> directly. A <circle>, <rect>, <ellipse>, or <line> has no d attribute, so convert it first with MorphSVGPlugin.convertToPath(). That call replaces the element in the DOM with an equivalent <path>, after which it morphs like any other path.

script.js
Control

The knobs that fix a bad morph

The default morph works for simple shapes. When the in-between frames look wrong, you switch from the shorthand string to the object form and reach for three options.

type: rotational

type: "linear" (the default) moves each point in a straight line to its target. type: "rotational" interpolates angle and length instead, which keeps curved shapes from collapsing through their own center mid-morph. Try it first whenever the linear morph caves in or kinks.

shapeIndex

shapeIndex offsets which point on the start path maps to the first point on the end path. It's the fix for a morph that twists or turns inside-out. Set shapeIndex: "log" once, read the suggested number out of the console, then paste it back in. For a path with several closed segments it takes an array, one value per segment.

map

script.js

map decides how start and end segments pair up: "size" (default), "position", or "complexity". If none of the three line the shapes up, the shapes are too different to morph as one path, split them into multiple paths and morph each separately.

When

Use it for

  • Icon state swaps where the outline changes (play to pause, hamburger to close, plus to minus)
  • Logo or mark animations that flow between two custom shapes
  • A blob or organic background shape that drifts between forms on a loop
  • Checkmark or status morphs in a form, where a circle resolves into a tick
  • Any shape transition where the silhouette itself has to change, not just its position or scale
Alternatives

Use something else when

  • You're drawing or erasing a stroke rather than reshaping a fill, use DrawSVG, which animates stroke-dashoffset
  • You're moving an element along a path rather than changing the path, use MotionPath
  • You're transitioning between two DOM layout states (cards, grids, list reorder), use Flip, it measures real elements and animates position and size
  • The shape change is a simple reveal or rounded-corner wipe, an animated CSS clip-path is lighter and needs no plugin
  • Both states are full DOM trees and you only need the browser to cross-fade them, the native View Transitions API does that without GSAP
In production

Used in these Annnimate components

The Annnimate library has a small morph family, and reading how each piece is built is the fastest way to learn which morph tool fits which job. Neither of these uses MorphSVG, because their content is HTML, not SVG paths, but they sit next to it and the contrast is the lesson.

  • Text Morph rearranges characters in a search bar or headline as you type. It uses GSAP Flip rather than MorphSVG, because the things moving are real text spans, not d-attribute paths. Reach for MorphSVG instead when the letterforms themselves are SVG outlines that have to reshape.
  • Morphing Dialog expands a card into a native <dialog> and reverses the move on close. It runs on the CSS View Transitions API, the right call when whole HTML blocks need to morph between two layouts. MorphSVG is for the case below that: a single vector outline changing shape.

MorphSVG is free now

MorphSVG was a paid Club GreenSock plugin for years. Since GSAP 3.13 every plugin is free for commercial use, after Webflow acquired GreenSock and made the full toolset free, fully live April 30 2025 (per Webflow's GSAP announcement). If a tutorial tells you MorphSVG needs a membership, it predates that change.
Used in components

See it running in production

FAQ

Common questions

Is MorphSVG free or do I need a Club GreenSock membership?
It's free. GSAP went 100% free for commercial use at version 3.13 after Webflow bought GreenSock, with the full plugin set live on April 30 2025 (per Webflow's announcement). MorphSVG used to be Club-only, so older tutorials still say it's paid, that's out of date. Import it from gsap/MorphSVGPlugin and register it like any other plugin.
Why does my morph twist or flip inside-out partway through?
The start and end points are paired in a way that crosses the shape over itself. Fix it with shapeIndex, which offsets where the mapping begins. Set shapeIndex: "log" once, copy the number it prints to the console, and put that back in the tween. If the shape has multiple closed segments, shapeIndex takes an array with one value per segment.
Can MorphSVG morph between two shapes that have a different number of points?
Yes, that's the whole point of it. The plugin converts both shapes to cubic beziers and adds anchor points to the simpler one until the point counts match, so a 4-point diamond can morph into a 12-point star with one tween. You don't hand-edit the paths to match.
How do I morph a <circle> or a <rect>?
Convert it to a path first. A circle or rect has no d attribute to interpolate, so call MorphSVGPlugin.convertToPath("circle, rect") before the tween. That swaps the element for an equivalent <path> in the DOM, and from there it morphs normally. Polygons and polylines morph without conversion.
MorphSVG vs animating CSS clip-path, which should I use?
Use clip-path for simple geometric reveals (a rectangle wiping open, a rounded inset growing) where you're clipping content, not reshaping a drawn outline. Use MorphSVG when an actual vector shape has to flow into a genuinely different shape, like an icon changing meaning, where you need point-level interpolation that clip-path can't express.