Independent control on selection and speed of node animation


In, for “CustomAnimationEffects” example, circle nodes animation are moving between all nodes at the same speed.

1- how can I set animation only for some links not all, based on some link properties such as color (fro example only do animation for links with red color)

2- how can I set different speed for each of those links.

note: the similar question also I have for “pathAnimation” example.

As you can see in the code in the animateColorAndFraction function that initiates the animation, it iterates over all of the Diagram.links and creates an Animation for each one. Clearly you could decide not to make an animation for particular links.

The animation that the example creates animates the GraphObject.segmentFraction property via the implementation of the “fraction” custom animation effect that is defined in the previous paragraphs. Because the segmentFraction goes from 0 to 1 (and back because the animation is Animation.reversible), the absolute speed at which the label moves depends on the length of the link because the Animation.duration is constant. But I suppose you could increase or decrease the duration proportional to the length of the link, and that way you could get the labels to move at similar speeds.

Thank you so much Walter!