ghost23
ghost23

Reputation: 2242

How to programmatically start a svg filter animation

i have build a little glow filter in the defs section of a svg snippet in my html page. That filter has an animation inside, that makes that filter slowly fade.

Now i assign that filter to some svg element, let's say, a rectangle. so far so good, works nice.

Problem, the animation starts right away, but i want to control, when it starts, like when i call a specific function in javascript.

Now i thought, i set the begin of the animation to "indefinite" and then call beginElement() on the animation. But how do i access the animation dom element within the filter, which is assigned to my svg rectangle via url("#myFilterID") ?

Upvotes: 0

Views: 627

Answers (1)

Robert Longson
Robert Longson

Reputation: 124219

Give it an id attribute and then call document.getElementById to retrieve it is probably easiest.

Upvotes: 0

Related Questions