I
I
Ivan9122019-06-09 18:18:20
JavaScript
Ivan912, 2019-06-09 18:18:20

Running svg animation from js?

There is an svg animation that is triggered by a button like this

begin="group1.click"// тут запуск этой анимация при нажатие на кнопку group1





  <g id="group1" transform="translate(-400 0)"> 
  <rect id="btn" x="398" y="448" width="48" height="18" rx="5" fill="#d3d3d3"  stroke="grey" />   
   <text id="txt1" x="402" y="460" font-size="10" font-weight="600" > Выстрел </text>
 </g>

How can I make this animation run from js, for example, on such a button?
btn115=document.createElement( 'BUTTON'); // создание кнопки

btn115.id='cmd888'; 
btn115.innerText = "Запуск анимации";
document.getElementById("container").appendChild(btn115); // нужно чтобы добавилось 
btn115.onclick=function(){

}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
koeshiro, 2019-06-09
@koeshiro

https://learn.javascript.ru/js-animation

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question