I want to change the attributes of an SVG line, and animate the transition to the new coordinates.
I am using reactjs to change the value of y2 in this example:
<line stroke='green' x1='0' y1='50%' x2='100%' y2='25%'>
to
<line stroke='green' x1='0' y1='50%' x2='100%' y2='75%'>
with CSS like
.myStuff * {
transition: all 1s;
}
Is it possible for a CSS transition to work on the y2 attribute? Or is there a way to set the attributes of the line in CSS like:
.myStuff line {
y2: 25%;
}
(which I know doesn't work)
I have considered using javascript, but that adds complexity
I have considered using SMIL, but I would have to store the old and new y2 states, and I don't think reactjs allows the animate element.
I have considered using a transform on my line element, and will go down this path if I can't find a better solution. I want to avoid the math and complexity.