Jump to content
Search Community

Best approach to animate a wavy line

JonoUWE test
Moderator Tag

Recommended Posts

Hey all. I've got a wavy svg path that I need to animate but articulating the exact nature of the animation I'm looking for isn't the easiest so bear with me. I need the effect to look like a cross section of waves moving, so each peak moves up and down slightly staggered behind the peak to its right. Each control point on the path will need to go up and down but there'll also need to be some rotation involved too I think to make it look natural. the complicating factor is the big dip in the middle of the path, but that needs to stay. I've been trying to figure it out but have got nowhere. Would gsap be the best thing to use here? Or is there an easier way of doing it that I'm blind to?

 

 

See the Pen eYXQOBq by mrjonoces (@mrjonoces) on CodePen

Link to comment
Share on other sites

Have you tried creating two shapes and then morphing them? That would be the most simple solution.

 

What you also can do is write out the path by hand and then update individual points directly with code, to me this is really magic and hard to understand, but with it you get the most control over what the animation is doing. Chris Gannon did a tutorial how you could go about doing this might be a good starting point. Hope it helps and happy tweening! 

 

See the Pen KKpzMJd?editors=0010 by chrisgannon (@chrisgannon) on CodePen

 

 

  • Like 4
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...