Jump to content
GreenSock

peacepostman

SVG wave animation

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

I added an option to show the points in case it's not clear what's going on. Each point is animated between the minRadius and maxRadius at a certain angle. And on every update, the catmull-rom/cardinal function creates a smooth path between all the points in a blob.

 

See the Pen vdzjyg by osublake (@osublake) on CodePen

 

 

  • Like 3
Link to comment
Share on other sites

12 hours ago, OSUblake said:

And don't be afraid to experiment. Everybody writes bad code, and everybody starts out at the same level. I was a total n00b at one point in time.

 

Appreciate the insight & advice, very interesting to hear. Also just checked the pen again & saw show points ... very cool!

  • Like 1
Link to comment
Share on other sites

  • 7 months later...
On 2/24/2018 at 11:46 PM, OSUblake said:

How's this @smallio

 

Create your blob like so. The options should be easy enough to understand.

 


var blob1 = createBlob({
  element: document.querySelector("#path1"),
  numPoints: 20,
  centerX: 500,
  centerY: 500,
  minRadius: 300,
  maxRadius: 325,
  minDuration: 1,
  maxDuration: 2
});

 

 

See the Pen vdzjyg by osublake (@osublake) on CodePen

 

 



@OSUblake How we can change width and height of this blob?

Link to comment
Share on other sites

Hi matthee,

 

Welcome to the forums.

 

An easy approach would be to put your paths in a group and scale the group like

 

TweenMax.to("#blobs", 3, {scale:4, repeat:-1, yoyo:true, transformOrigin:"center"})

 

See the Pen OBVdNN?editors=0010 by GreenSock (@GreenSock) on CodePen

 

if you don't want to animate the scaling, use set() – which is a tween with no duration.

 

TweenMax.set("#blobs",  {scale:4, repeat:-1, yoyo:true, transformOrigin:"center"});

 

edit: updated with proper pen

 

Link to comment
Share on other sites

@Carl thanks for your reply!

But is this possible to change width and height like that?Screenshot_at_18-03-41.png 

 

Link to comment
Share on other sites

Hi @matthee,

 

Here are some additional comments on CARL's great example.


With '.fromTo' the range of scaling can be defined. With separate tweens per axis, the axes can be animated offset (different durations). Depending on the scaling the SVG should be set with 'overflow: visible'.


And: Try out the options that @OSUblake offers: for example 'centerY' or 'numPoints' ...

 

See the Pen jePRLb by mikeK (@mikeK) on CodePen

 

happy tweening and a unique blob ...

Mikel

 

 

  • Like 1
Link to comment
Share on other sites

  • 4 months later...
On 3/17/2017 at 12:49 PM, peacepostman said:

Hello,

 

I've adapted an existant codepen to a jquery plugin in order to animate a svg into a random wave effect. I managed to use tweenMax in order to smooth the animation but i dont know if i've done that properly or if something can be improved or re-writed in a more clever way.

 

Feel free to copy the jquery plugin if you need it :)

 

Best regards,

See the Pen jBavvN by peacepostman (@peacepostman) on CodePen

 

How to remove the resize effect on windows resize, and keep it always at 100% in width?

 

Link to comment
Share on other sites

Hi DAM,

 

I am not sure I understand what you are asking for here, can you rephrase it please?

Link to comment
Share on other sites

  • 5 months later...

Can any one help me to animate the sea waves hitting wall and rebounding back?

Link to comment
Share on other sites

Hey @ABS,

 

Welcome to the GreenSock Forum.

 

It would be great to create a new topic for such a question.

 

AND: Where's the wall? What kind of wave?
Please provide a reduced CodePen to imagine what you want to animate.

 

Kind regards

Mikel
 

Link to comment
Share on other sites

Hello sir,

 

I have attached HTML file with this message.

 

Thank you

 

wavy.html

Link to comment
Share on other sites

  • 1 month later...

Sir,

Here is my code : 

See the Pen RwbyNGG by AABBSS (@AABBSS) on CodePen

Can you help me to animate the waves hitting wall and rebounding back?

Link to comment
Share on other sites

1 hour ago, ABS said:

Can you help me to animate the waves hitting wall and rebounding back?

 

Do you have a GSAP question? It doesn't look like you're using GSAP.

 

This type of question is beyond the scope of the forum. Having a wave rebound off a wall is incredibly difficult to do. You would most likely need some type of physics engine.

http://google.github.io/liquidfun/

 

See the Pen XRvBNg by ste-vg (@ste-vg) on CodePen

 

 

  • Like 2
Link to comment
Share on other sites

  • 4 months later...

Hello all,

 

I am very new to coding and I am trying to create a website similar to this one: https://www.cavempt.com/

 

It seems to be using SVG for the wave animations. If you guys have any ideas how I can figure out this effect that would be awesome!
 

Cheers,

 

Adam

Link to comment
Share on other sites

Hey @Adamk247 and welcome to the GreenSock forums.

 

This thread should provide you insight on how to animate waves. Another similar thread that may help is 

Other than that, please let us know if you have specific questions. We don't have the capacity to build out every effect that users ask for :) 

Link to comment
Share on other sites

Thank you for your response @ZachSaucier and for giving me the other thread to check out! I’m sure when I begin working through it more I will have more specific questions that I can ask.

 

That does look very similar and will help me while I’m trying to build my site! :)

 

Link to comment
Share on other sites

I have created this example in CodePen and am wondering why the SVG wave in front is not clipping out the image animation behind. Any help would be awesome.

 

See the Pen LYEaXJB by adam-knauer (@adam-knauer) on CodePen

 

Thank you!

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.
×