Jump to content
Search Community

Animating SVG's fill-opacity

dxc test
Moderator Tag

Go to solution Solved by Diaco,

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

  • Solution

Hi dxc  :)


Since there isn't the "fill-opacity" at first  , you should create that attr , and then tween that ;

try this :

var moon = document.getElementById("moon");
TweenLite.to(moon, 1, {attr:{"fill-opacity":.5}});

or add that attr to svg path tag in html :

<path id="moon" fill="#9C2726"  fill-opacity=1 ..../>
  • Like 3
Link to comment
Share on other sites

  • 3 months later...
  • 1 month later...
  • 3 years later...

For (my own) future reference, here's what works, showing that a circle's radius needs to be tweened within the attr property but stroke-width, stroke-opacity and fill-opacity (for example) don't:


<circle cx="75" cy="130" r="0" id="wave"/>
var tl = new TimelineMax({repeat:-1});
tl.to("#wave", 1, {attr:{r:100}, 'stroke-opacity': 0, 'stroke-width': 5, 'fill-opacity': 0});


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...