06-25-2018 07:54
06-25-2018 07:54
Let's say I want to be able to programmatically animate the fill color of an image using any of the following transitions:
Setting up any one of those transitions is straightforward:
<svg>
<defs>
<symbol id="image-symbol"> <image href="images/image.png" /> <animate id="animate" begin="enable" attributeName="fill" from="#ff0000" to="#00ff00" dur="0.25" /> </symbol>
</defs>
<use id="image" href="#image-symbol" />
</svg>
However, in order to accommodate all of those transitions, I would ideally be able to set the from and to attributes dynamically in JavaScript. I was hoping to be able to do that in the following way:
let image = document.getElementById("image");
let animate = image.getElementById("animate");
animate.from = "#ff0000";
animate.to = "#0000ff";
However, this doesn't work. Is there any way to access these from and to attributes?
06-29-2018 13:27
06-29-2018 13:27
You can't in the current version of the firmware, but I've requested this already and it should be available in a future update.
03-05-2020 09:05
03-05-2020 09:05
Hi,
Is it possible now as almost 2 years have passed?
03-06-2020 01:12
03-06-2020 01:12
@_prasad1120 wrote:
Hi,
Is it possible now as almost 2 years have passed?
Yes, it's possible. Get the element by ID, set the value. `animElement.from=20`