은 SVG가 얼마나 복잡한 당신이 최적화를 많이하지 않고 도전이 될 것입니다 충분히 빨리 DOM 객체를 교체 찾을 수에 따라
아주 간단한 자바 스크립트 (this answer 유용 디테일과 비교를 많이 포함) 예를 들어 이것을 달성하는 방법은 SVG 항목의 배열을 단계별로 실행하고 프레임 속도에 맞춰 설정된 setInterval 타이머에서 스왑하는 것입니다 (AndroidTV 앱에서 배경 로딩 애니메이션을 기반으로하는 코드를 사용했습니다. 꽤 안정적으로 일했다)
<svg height="200" width="200" id="svg">
</svg>
<script>
var fps = 30
var f = 0
var svgA = [
'<circle cx="50" cy="60" r="40" stroke="black"stroke-width="3" fill="red" />',
'<circle cx="55" cy="62" r="42" stroke="black"stroke-width="4" fill="red" />',
'<circle cx="60" cy="64" r="44" stroke="black"stroke-width="5" fill="red" />',
'<circle cx="65" cy="66" r="46" stroke="black"stroke-width="6" fill="red" />',
'<circle cx="70" cy="68" r="48" stroke="black"stroke-width="7" fill="red" />',
'<circle cx="74" cy="70" r="50" stroke="black"stroke-width="8" fill="red" />',
'<circle cx="77" cy="72" r="48" stroke="black"stroke-width="9" fill="red" />',
'<circle cx="79" cy="74" r="46" stroke="black"stroke-width="8" fill="red" />',
'<circle cx="80" cy="76" r="44" stroke="black"stroke-width="7" fill="red" />',
'<circle cx="79" cy="74" r="46" stroke="black"stroke-width="6" fill="red" />',
'<circle cx="77" cy="72" r="48" stroke="black"stroke-width="5" fill="red" />',
'<circle cx="74" cy="70" r="46" stroke="black"stroke-width="4" fill="red" />',
'<circle cx="70" cy="68" r="44" stroke="black"stroke-width="3" fill="red" />',
'<circle cx="65" cy="64" r="42" stroke="black"stroke-width="2" fill="red" />',
'<circle cx="55" cy="62" r="40" stroke="black"stroke-width="3" fill="red" />'
]
var i = setInterval(function() {nextFrame();}, 1000/fps);
function nextFrame() {
document.getElementById("svg").innerHTML = svgA[f];
f=(f+1)%svgA.length
if (f==0) {
clearInterval(i)
}
}
</script>