Jump to content
Search Community

Infinitely morph between two svg paths with a delay inbetween

Irfanm test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hi, I was trying to watch through the tutorial videos and I didn't see something for iteration count for a morph, is this possible with gsap? I already love all the amazing things I've been able to do, but how could I morph path with id #A to sibling path with id #B and then #B to #A, in an alternating direction indefinitely with a 3second delay inbetween? So it says on each morph for 3 seconds and then morphs to the other.


I apologize if I am asking too much. Also, is there callback functions? What would this line look like if I did the above, but once B was finished, a function was called.


Thank you

Link to comment
Share on other sites

Hi @Irfanm :)


Yes - you can certainly create an infinite repeat with a delay. The easiest way would be setting yoyo:true and repeat:-1. Something like this:

TweenMax.to("#pathA", 1, {morphSVG: "#pathB", repeat:-1, repeatDelay:3, yoyo:true});


If you want to set a certain number of repeats and then call a function, you'd write it like this:

TweenMax.to("#pathA", 1, {morphSVG: "#pathB", repeat:3, repeatDelay:3, yoyo:true, onComplete:onComplete});

function onComplete() {


More info in the docs:




Hopefully that helps. Happy tweening.



  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...