Is there a way to animate a value of dy attribute of SVG's tspan using JavaScript, ideally using Web Animations API?
The value of dy is known to be animatable using <animate /> element (as seen here):
<svg>
<text x="30" y="30">FairBridge
<animate attributeName="dy" from="0 0 0" to="0 -20 20" dur="1s" repeatCount="indefinite"/>
</text>
</svg>
I am wondering if it's possible to convert that animation to JavaScript.
For context, I've been using KeyframeEffect for all my previous animations, and would prefer to use it to animate the attribute value too in order to keep the animations code consistent.
In case there's absolutely no way to use KeyframeEffect, how would one go about animating a generic value of a tag attribute?