aktuelle.kurse/m152/auftraege/x_gitressourcen/Animationen/SVG/20_SVG_Animated with JavaScript.html

24 lines
410 B
HTML
Raw Normal View History

2021-06-25 16:17:59 +02:00
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<h1>Karussell fahren</h1>
<svg>
<rect id="myRect" width="40" height="80" x="50" y="100" fill="red" />
</svg>
<script>
let y = 0;
let x = document.getElementById("myRect");
window.setInterval(function(){
y+=1;
x.setAttribute('transform','rotate(' + y + ', 50,80)');
}, 5);
</script>
</body>
</html>