I have a JSFiddle here. I have animated the drawing of a path
element using walkway.js
and it works great, but after the drawing is completed I would like to animate the fill of the svg
's path element. I have tried giving the path the following CSS:
path {
transition: fill 2.0s linear !important;
}
and on the callback function (executed when the .draw()
is completed) I change the value of the path's fill
by applying the class testClass
like so:
.testClass {
fill:black;
}
This isn't working - the transition is not being applied and when the callback is called it instantly 'flicks' black-- no fade in at all. This same method has worked on plain html elements, not involved with SVGs. I appreciate any help.
Give it something to transition from, by adding
fill: white
to your path.http://jsfiddle.net/yh2jzoxa/4/
You can't transition fill from nothing to black. Add original fill to
path
fiddle