✳ Web Tattva Labs← Back to Labs

SVG Path Morphing (SMIL).

Animate an SVG path’s d attribute between two matching command sequences.

View code
<svg width="150" viewBox="0 0 200 200" role="img" aria-label="Hexagon morphing into an angular shape">
  <path fill="currentColor" d="M100 20 L175 62 L175 138 L100 180 L25 138 L25 62 Z">
    <animate attributeName="d" values="M100 20 L175 62 L175 138 L100 180 L25 138 L25 62 Z;M100 7 L124 76 L191 86 L136 126 L151 183 L72 151 Z;M100 20 L175 62 L175 138 L100 180 L25 138 L25 62 Z" dur="3s" repeatCount="indefinite"/>
  </path>
</svg>