I am making a model of the solar system where all the planets are orbiting the sun. I am doing this with the following code:
.neptuneOrbit {
--time: 19;
--dist: 2.76;
--size: .85;
z-index: 2;
}
.orbitContainer {
width: 10rem;
--timeunit: 10s;
--offsetunit: 30vmin;
--sizeunit: 5vmin;
position: absolute;
top: calc(50% - calc(var(--size) * var(--sizeunit)));
--offset: calc(var(--dist) * var(--offsetunit));/* distance from the center */
left: calc(50% - var(--offset));
width: calc(2 * var(--offset));
animation: circleRound calc(var(--time) * var(--timeunit)) linear infinite;
}
.orbitContainer .inner {
position: relative;
width: calc(calc(2 * var(--size)) * var(--sizeunit));
height: calc(calc(2 * var(--size)) * var(--sizeunit));
border-radius: 50%;
border-style: none;
}
@keyframes circleRound {
100% {
transform: rotate(360deg);
}
}
And in app.js
<div className="orbitContainer neptuneOrbit"> <MiniPlanet className="neptuneMini inner" name="neptune" /></div>
The miniPlanet component only holds the textures.
The issue is that when the planets are orbiting, they are also rotating 360 degrees. So that the north or south pole eventually face the sun. I am trying to have the planets orbit in a "fixed" position to where they will face the same direction while going in a circle. I cannot accomplish this without breaking the orbit animation however.