javascript - Concurrency transitions in D3 (circle following filling path) -
i trying create simple animated gauge charts, red points on end of each circle. whole example in here https://jsfiddle.net/yhlch8fc/3/ (please not solve text position, it's not problem). tried search on stack overflow, tutorials change starting point of alongpath animation not helping me, because path translated x,y , rotated. thing key part of code is:
circle.transition().duration(_duration)     .attrtween('cx', arccirclex(_mypath.node()))     .attrtween('cy', arccircley(_mypath.node()));   you can easy switch similar version (code stack overflow above):
circle.transition().duration(_duration)     .attrtween('transformation', circletween(_mypath.node()));   i don't know why, seems red circle goes left side. maybe it's because original path translated , rotated.
(the original version was, when try follow filling path, not work either.)
instead of rotating hover path, rotate g element contains both path , circle:
enter.append("g").attr("class", "hover")      .attr("transform", "translate(" + _width / 2 + "," + _width / 2 + "), rotate(-90)");   then:
circle.transition().duration(_duration)    .attrtween('transform', circletween(_mypath.node()));   here's example. after?
Comments
Post a Comment