Jump to content
Search Community

Animating box shadow smoothly with GSAP

padders test
Moderator Tag

Go to solution Solved by GreenSock,

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, 

 

I found a rather nice animated rainbow effect in a text demo a few days ago, and I wanted to recreate it with GSAP to try and improve the performance and hopefully add some nice effects to it as well. When I do however I get choppy transitions instead of the smooth transitions I get using the original CSS from the demo.

 

Here's the CSS version

 

See the Pen mJKezY by padders1980 (@padders1980) on CodePen

 

and here's my simple GSAP version

 

 

I added a timer to my GSAP version so you could see when the timeline starts (although it seems to go out of sync if you leave it a while...). I'm obviously doing something strange but I can't spot it, and I've been staring at rainbows so long now that I feel dizzy! Does anyone have any ideas? Also, can anyone think of some nice ways to improve the effect?

 

The original demo is here by the way, it has some rather nice SVG text effects :)

 

http://tympanus.net/codrops/2015/02/16/create-animated-text-fills/

See the Pen waXKOK by padders1980 (@padders1980) on CodePen

Link to comment
Share on other sites

  • Solution

It wasn't your fault - it's just that named colors aren't parsed as tweenable for boxShadow, so you should use either hex values or rgb(). In other words, replace "purple", "yellow", and "red" with "#800080", "#FFFF00", and "#FF0000" like this:

http://codepen.io/GreenSock/pen/9d05d09b2cd8b9ac2c2f8ea704c27aba/

 

Is that what you were looking for? 

  • Like 4
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...