Skip to content
Discussion options

You must be logged in to vote

https://animejs.com/documentation/svg/morphto only works when targeting a SVGPolygonElement, SVGPolylineElement or SVGPathElement.
And I believe that in your example, #moon and #sun are SVGElement.
You need to be more precise in the the parts of your SVG that you're trying to animate.
Something that should look more like this, but of course you'll need to decide which path element of your icon should be morphed:

animate('#sun path', {
  d: svg.morphTo('#moon path'),
  ease: "inOutCirc",
  duration: 500
});

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@PapiPeppers
Comment options

Answer selected by PapiPeppers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants
Converted from issue

This discussion was converted from issue #1055 on July 31, 2025 16:29.