Jump to content

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

Adding fill to an SVG

Recommended Posts

Hello there,


Just simply trying to add a background-color or Fill to an SVG.. Wondering why it's not working.


var tween2 = TweenMax.from('.st0', 0.5, {
        fill: #000000



See the Pen MpQzam by erayner (@erayner) on CodePen

Link to comment
Share on other sites

Hi erayner_45092  :)


Just a couple little things. Your fill color is a string so you need to put it into quotes. The other issue is your tween was running at the same time as your timeline so even if the fill color had been formatted correctly, the tween would have ended too quickly and you wouldn't have seen the change. Please try adding it to the end of your timeline like this:

svgTween.from('.st0', 0.5, {fill: "#000000"});

If you do that, all should be working correctly for you.


Happy tweening.


  • Like 4
Link to comment
Share on other sites



Things are starting to make sense to me now :)


Thanks a lot!

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