I'm working on a non-linear menu and I'd like it to have a nice animation when hovering over the options. I managed to put together a turbulence svg filter that I like. Now I'm wondering how to make it so that when one hovers over the option the turbulence ramps up progresively, and that the same happens in the opposite direction on mouse out, it slowly fades out.
What's the most straightforward way of addresing this through js?
I'm not well acquaintanced with svg filters. Should I directly manipulate the baseFrequency's values? I reckon that would affect all nodes and not just the one being hovered over. Is there any way css can be leveraged? Is there any way to pass arguments into a filter?
Here's the hand-crafted svg filter code along with the -simplified- svg code exported from my design app. I've omitted the circle's stroke data.
<defs>
<filter filterUnits="userSpaceOnUse" id="turbulence" x="0" y="0" width="100%" height="100%">
<feTurbulence id="base_turbulence" numOctaves="3" seed="2" baseFrequency="0.02 0.05"></feTurbulence>
<feDisplacementMap scale="20" in="SourceGraphic"></feDisplacementMap>
</filter>
<animate xlink:href="#base_turbulence" attributeName="baseFrequency" dur="60s" keyTimes="0;0.5;1" values="0.01 0.02;0.02 0.03;0.01 0.03" repeatCount="indefinite"/>
</defs>
<g id="ser" class="node" transform="matrix(1,0,0,1,84,88)">
<g class="circle" transform="matrix(1,0,0,1,-12,13)" filter="url(#turbulence)">
<g transform="matrix(1,0,0,1,-179,-8)">
<circle cx="512.5" cy="229.5" r="53.5" style="fill:rgb(255,235,187);"/>
<path d="(...)"/>
</g>
<g class="marker" transform="matrix(1.24299,0,0,1.24299,-303.533,-63.7664)">
<path d="(...)"/>
</g>
</g>
<g transform="matrix(1,0,0,1,0,-21.3664)">
<text x="342px" y="229px" style="font-family:'LibreBaskerville-Regular', 'Libre Baskerville';font-size:47.751px;stroke:rgb(2,2,2);stroke-width:1px;">S<tspan x="379.962px 414.486px " y="229px 229px ">er</tspan></text>
</g>
<g transform="matrix(1,0,0,1,-18.1341,1.72278)">
<text x="344.149px" y="246px" style="font-family:'LibreBaskerville-Regular', 'Libre Baskerville';font-size:25.202px;stroke:rgb(2,2,2);stroke-width:1px;">El Silencio Donde Escucho</text>
</g>
</g>
<g id="propuestas" class="node" transform="matrix(1,0,0,1,137.028,83)">
<g class="circle" transform="matrix(1,0,0,1,-126.851,580.865)">
<g transform="matrix(1,0,0,1,-179,-8)">
<circle cx="512.5" cy="229.5" r="53.5" style="fill:rgb(187,205,255);"/>
<path d="(...)"/>
</g>
<g class="marker" transform="matrix(1.24299,0,0,1.24299,-303.533,-63.7664)">
<path d="(...)"/>
</g>
</g>
<g transform="matrix(1,0,0,1,-115,543.634)">
<text x="342px" y="229px" style="font-family:'LibreBaskerville-Regular', 'Libre Baskerville';font-size:47.751px;stroke:rgb(2,2,2);stroke-width:1px;">P<tspan x="381.968px 411.383px 449.775px 489.36px 528.517px 563.041px 591.883px 617.095px 650.712px " y="229px 229px 229px 229px 229px 229px 229px 229px 229px ">ropuestas</tspan></text>
</g>
<g transform="matrix(1,0,0,1,-133.134,566.723)">
<text x="344.149px" y="246px" style="font-family:'LibreBaskerville-Regular', 'Libre Baskerville';font-size:25.202px;stroke:rgb(2,2,2);stroke-width:1px;">Encuentr<tspan x="463.279px " y="246px ">o</tspan>s, taller<tspan x="571.371px " y="246px ">e</tspan>s, seminarios</text>
</g>
</g>
I'm targeting circles within nodes to have the effect.
And this is the result as is:
Thanks!
Via Active questions tagged javascript - Stack Overflow https://ift.tt/WGO5NYF
Comments
Post a Comment