Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
jp_uk81

Animating svg drop shadow

Recommended Posts

Hi guys,

I'm trying to animate this svg to give the effect as it lifted off the background. In this pen I tried to animate the scale and the drop shadow and the animation is triggered with scrollmagic. 

 

I have set the initial drop shadow in the CSS as advised by Dipscom here but the drop shadow doesn't animate.

 

What am I doing wrong?

 

If this effect can't be achieved this way is there another way to approach it?

 

thank you

 

See the Pen gByBvR by Jp_uk (@Jp_uk) on CodePen

Link to comment
Share on other sites

Hi @jp_uk81

 

There's a problem with the order in certain browsers. For example, Chrome reports the color first.

 

element.style {
  filter: drop-shadow(rgba(0, 0, 0, 0.1) 0px 0px 14px);
}

 

 

My workaround, use CSS variables.

 

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

 

  • Like 8
Link to comment
Share on other sites

That's great! thank you for your help

 

Link to comment
Share on other sites

  • 2 weeks later...

Hi Guys, 

the above work well on the codepen but on my site the animation is really jerky, in particular when you click the down arrow to scroll down to the section with the animate V. While the window is scrolling it stops for a moment and then carries on to the bottom. 

What could cause this?

Thank you

 

Link to comment
Share on other sites

Are you using a HiDPI monitor, like retina, 4k, 5k. Those can kill performance, particularly with something that is costly to render like a drop shadow.

 

  • Like 2
Link to comment
Share on other sites

I'm using a led-backlit display with IPS technology (27"). I thought the poor perfomance was code related. If is because of the display then I'll just have to live with it. 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.

×