drawsvg icon indicating copy to clipboard operation
drawsvg copied to clipboard

gradient stop animation

Open LittleLeonie opened this issue 4 years ago • 5 comments

am i missing something or is these as it stands no way to add an animation to a gradient stop?

LittleLeonie avatar Feb 27 '21 19:02 LittleLeonie

closed because i found the otherElem parameter of the Animate() class.

LittleLeonie avatar Feb 27 '21 19:02 LittleLeonie

Glad you solved it. Was the issue that you couldn't do something like this?

gradient = ...
stop = gradient.addStop(...)  # addStop doesn't return anything currently.
stop.appendAnim(...)

Can you share how you did it using the otherElem parameter?

cduck avatar Feb 28 '21 20:02 cduck

That was exactly what i tried yea. The otherElem parameter sets the xlink:href attribute of the <animate> element, if you give the stop an id, by using the id parameter of the addStop() method, you can use that given id as the value for the otherElem parameter.

gradient = ...
gradient.addStop(id="stop", ...)
gradient.appendAnim(Animate(otherElem="#stop", ...))

LittleLeonie avatar Mar 01 '21 23:03 LittleLeonie

Thanks. I'll consider this a bug with the package because you shouldn't be required to use manual ids like that.

I'm going to reopen this issue until I (or someone else) fixes this. The addStop method should return the element it creates so the code I gave works as expected.

cduck avatar Mar 02 '21 01:03 cduck

alright, many thanks!

LittleLeonie avatar Mar 03 '21 10:03 LittleLeonie