Jump to content
GreenSock

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

DrawSVGPlugin Chaning background colors smoothly

Recommended Posts

Hi,

 

I want to change the color of this box/background, smoothly from one color to the next.  Right now, each time it changes color, it jumps back to alpha 0 and then fades the new color in.  If I set alpha to 1 then the last color covers the other colors.  You'll see what I mean in my pen.

 

Thanks,

 

-Stefan

 

See the Pen LpVaXw by anon (@anon) on CodePen

Link to comment
Share on other sites

Hi sjerrentrup :)

 

pls use rgb() colors instead of rgba() :  rgba = red , green , blue , alpha

 

and i don't know what's your scenario but i think you just need fromTo tween for first one , like this :

var tl = new TimelineLite();

tl.fromTo(".bkg", 4, {fill:"rgba(250,250,250,0)"}, {fill:"#934512"}) 
.to(".bkg", 4, {fill:"#129330"})
.to(".bkg", 4, {fill:"#461293"})

and with last version ( 1.18.0 ) you can tween colors easily with hsl() colors . like this :

 

var tl = new TimelineLite();

tl.fromTo(".bkg",4,{fill:"rgba(250,250,250,0)"},{fill:"#934512"}) 
  .to(".bkg",12,{fill:"hsl(360,100%,25%)" }) 
  • Like 3
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.
×