Skip to main content

Ramp in and out SVG turbulence filter

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:

svg turbulence animation

Thanks!

Via Active questions tagged javascript - Stack Overflow https://ift.tt/WGO5NYF

Comments

Popular posts from this blog

Where and how is this Laravel kernel constructor called? [closed]

Where and how is this Laravel kernel constructor called? public fucntion __construct(Application $app, $Router $roouter) { } I have read the documentation and some online tutorial but I can find any clear explanation. I am learning Laravel and I am wondering where does this kernel constructor receives its arguments from. "POSTMOTERM" CLARIFICATION: Here is more clarity.I have checked the boostrap/app.php and it is only used for boostrapping the interfaces into the container class. What is not clear to me is where and how the Kernel class is instatiated and the arguments passed to the object calling the constructor.Something similar to; obj = new kernel(arg1,arg2) or, is the framework using some magic functions somewhere? Special gratitude to those who burn their eyeballs and brain cells on this trivia before it goes into a full blown menopause alias "MARKED AS DUPLICATE". To some of the itchy-finger keyboard warriors, a.k.a The mods,because I believe in th...

Why is my reports service not connecting?

I am trying to pull some data from a Postgres database using Node.js and node-postures but I can't figure out why my service isn't connecting. my routes/index.js file: const express = require('express'); const router = express.Router(); const ordersCountController = require('../controllers/ordersCountController'); const ordersController = require('../controllers/ordersController'); const weeklyReportsController = require('../controllers/weeklyReportsController'); router.get('/orders_count', ordersCountController); router.get('/orders', ordersController); router.get('/weekly_reports', weeklyReportsController); module.exports = router; My controllers/weeklyReportsController.js file: const weeklyReportsService = require('../services/weeklyReportsService'); const weeklyReportsController = async (req, res) => { try { const data = await weeklyReportsService; res.json({data}) console...

How to show number of registered users in Laravel based on usertype?

i'm trying to display data from the database in the admin dashboard i used this: <?php use Illuminate\Support\Facades\DB; $users = DB::table('users')->count(); echo $users; ?> and i have successfully get the correct data from the database but what if i want to display a specific data for example in this user table there is "usertype" that specify if the user is normal user or admin i want to user the same code above but to display a specific usertype i tried this: <?php use Illuminate\Support\Facades\DB; $users = DB::table('users')->count()->WHERE usertype =admin; echo $users; ?> but it didn't work, what am i doing wrong? source https://stackoverflow.com/questions/68199726/how-to-show-number-of-registered-users-in-laravel-based-on-usertype