Jump to content
Search Community

Need to change direction of feTurbulence filter

lessing test
Moderator Tag

Go to solution Solved by OSUblake,

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 there,

trying to get this girls hair waving from wind. Obviously the parameters are not set to look like waving hair just yet, I've set them to show you my problem:

 

The waves are coming in horizontally. I get that this is a property of the feTurbulence filter, but I just can't for the life of me get the SVG right to animate things vertically instead!

I was trying to separate baseFrequency into baseFrequencyX and baseFrequencyY to be able to animate them separately, but it's not working for me.

So either I need to somehow rotate whole/parts of the SVG filter, or animate the baseFrequency matrix.

 

Anyone who has a clue?

 

Thank you!

See the Pen RGqqwX?editors=1010 by lessing (@lessing) on CodePen

Link to comment
Share on other sites

Hello lessing, and welcome to the GreenSock Forum!

 

Have you looked at the SVG spec documentation for <feturbulence>?

 

One way is to play with the baseFrequency attribute  ..

  • The baseFrequency attribute represent The base frequencies parameter for the noise function of the <feturbulence> primitive. If two <number>s are provided, the first number represents a base frequency in the X direction and the second value represents a base frequency in the Y direction. If one number is provided, then that value is used for both X and Y.

 

baseFrequency: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/baseFrequency

 

Another way is to rotate the SVG graphical element that the turbulence filter is applied to, to change the direction.

 

:)

  • Like 3
Link to comment
Share on other sites

Thank you Jonathan!

I understood the principle of providing two values for X,Y, but I don't get how I animate them in GSAP?

 

In the SVG i type

 

baseFrequency="0,0"

 

then I want to animate only the second variable, so I would expect either 

 

TweenMax.to("#turbulence", 8, {

  attr:{"baseFrequency":"0,0.1",
  repeat:-1,
  yoyo:true
});
 

or 

 

TweenMax.to("#turbulence", 8, {

  attr:{"baseFrequency":[0,0.1],
  repeat:-1,
  yoyo:true
});
 

But I can't get it to work? How do I feed GSAP with a string that's actually an arrayish thingie? ;)

 

Also very interested in where I should put a rotation of the filter, as I've tried pretty much every node in the SVG tree and nothing works ;(.

 

Thank you!

Link to comment
Share on other sites

Thank you both, that's so kind!

I knew it couldn't be that hard ;)

 

Regarding which method: I did think about morphing instead, but manually creating keyframes to morph between in Illlustrator seemed a bit tedious. Problem is, most filters (e.g. waves) in Illustrator do not have a "time" property for obvious reasons.

 

Another alternative I was considering was to generate a GIF in After Effects, but the aliasing would probably be nasty. Maybe one could use 20 PNGs to cycle between and still get a decent size?

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