I'm having problem with a project of mine, I want to rotate an planet on it's orbit around the sun to a certain degree that comes from an equation. I'm looking for a way to rotate a planet withount a need of doing 360 classes in CSS just to change them everytime. That degree is calculated from latitude and the angle of the planet's inclination, here's my code so far
function gorowanie(){
var wysokosc=document.getElementById("licz1").value;
var nachylenie=document.getElementById("licz2").value;
var polkola=document.getElementById("lista").value;
var wynik=0;
if(polkola=="1"){wynik=90-Number(wysokosc)+Number(nachylenie);}
else if(polkola=="2"){wynik=90+Number(wysokosc)+Number(nachylenie);}
else{wynik=90;}
document.getElementById("linia").style.transform="rotate("+(Number(wynik)-90)+"deg)";
document.getElementById("wynik").innerHTML=wynik+"°";
}
If it helps I'll throw a photo of the project here (https://i.stack.imgur.com/puLKU.png)
I was looking for something that can help me with that but sadly I just can't find anything that could help me, I was trying to use translate somehow but I just can't seem to get a good outcome. I would be thankfull if someone gave me an idea how to do it.