I am trying to tween from a line to a area. When starting the animation the fill color of the area (polygon) is black. I tried to asign
style("fill", "none")
as I wanted it to start from a transparent fill color. But it still keeps fading from black to the desired color.
Here is how I did the transition
d3.select("#line")
.transition()
.duration(dur)
.delay(del)
.attr("d", DATA) // old data was a line, new data is an area
.style("fill", "red");
Any ideas how to assign a transparent fill color?
Thank you in advanced
Rick
I finally got it. The desired property is not "opacity", it is "fill-opacity". With
d3.select("#line").style("fill-opacity", 0)
.transition()
.duration(dur)
.delay(del)
.attr("d", DATA) // old data was a line, new data is an area
.style("fill-opacity", 1)
.style("fill", "red");
it works like a charm.
Btw. Thank you Prasath for keeping on it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.