<< Javascript Tipp
var flyer = document.getElementById("flyer");
var astronaut = document.getElementById("astronaut");
var requestId = undefined;
var i = 0.3;
var posX = 500;
var posY;
var rota;
var heightA = 245;
var radius = Math.min(window.innerHeight / 3, window.innerWidth / 3);
function animate(timestamp) {
i = timestamp / 2000;
posXA = Math.cos(i) * 500 + 500;
posYA = Math.sin(i) * 300 + 300;
posY = Math.sin(i) * radius + 200;
if (posX < -250) {
posX = window.innerWidth + 20;
} else {
posX -= 2;
}
flyer.style.left = posX + "px";
flyer.style.top = posY + "px";
astronaut.style.right = posXA + "px";
astronaut.style.top = posYA + "px";
rota = Math.sin(i/5) * 40;
heightA = ( Math.sin(i)) * 70 + 175;
astronaut.height = heightA;
astronaut.style.transform = "rotate(" + rota + "deg)";
rota = Math.sin(i) * 90;
requestID = requestAnimationFrame(animate);
}
requestID = requestAnimationFrame(animate);