I am building a solar system viewer app. at the moment I have 8 objects that are orbiting a central point using the following method.
.orbitContainer {
width:var(--s);
height:var(--s);
margin:auto;
text-align: center;
border-radius: 50%;
animation: spin var(--d) linear infinite, translateBackground 100s infinite linear;
transform:rotate(0) translate(var(--o)) rotate(0);
}
@keyframes spin {
100% {
transform:rotate(1turn) translate(var(--o)) rotate(-1turn);
}
}
.mercuryPath {
--d:20s;
--o:4.5rem;
--s: 12rem;
z-index: 9;
}
This is working fine, but the 6th object is saturn, which has rings. I am trying to overlay the rings image I have on to the element which represents saturn
This is my attempt so far
<div className="orbitContainer saturnPath" >
<MiniPlanet name="saturn" className="orbitContainer saturnMini " />
<img src="./components/planetTextures/rongs.png" alt="rings"></img></div>
I thought my putting the image in the same path container as the planet, that it would at least rotate in a similar position. However it seems to be moving around randomly.
I would like to know how to overlay the rings on the planet, or another method of accomplishing this. The planets each have atmospheric effects so I cannot just use a static image of saturn with rings unfortunately.
Here is a codesandbox with my code.