Animation on link does not work for LayeredDigraphLayout

Hello,
I have a network of nodes and links based on “https://gojs.net/latest/intro/animation.html#CustomAnimationEffects”. It is working normally, but when I modify the layout to “LayeredDigraphLayout”, the animation circles do not go through the whole link, any idea? Thank you.

Note: when I set “setsPortSpots: false”, it is working well.
but, when I change “setsPortSpots: true”, the animation only runs on a small part of a link from a node, not the whole link.

Yes, by default oriented layouts such as LayeredDigraphLayout set the Link.fromSpot and Link.toSpot, thereby causing those link routes to have short end segments in addition to whatever route they normally would have had.

If you have the very latest version, you can now set GraphObject.segmentIndex to NaN, so that the segmentFraction, which always goes from zero to one, now extends to cover the whole route rather then just one segment.

The original value for segmentIndex in that sample was zero, which caused the animation to extend only along segment zero. When there had been only one segment for the whole route, then the animation would go the whole way. But with the fromSpot and toSpot, there are now three segments, and the first segment only extends that short distance of the “from” end segment.

Thank you so much Walter!