This forum is now read-only. Please use our new forums at discuss.codecademy.com.

Sun, Earth, and Code Forum

View Course » View Exercise

530 points
B1110cd36ddbf042741e0cec6941cb4b?s=140&d=retro
Submitted by
Kenneth Mitra
about 3 years ago

Why does Earth spin with the orbit?

I got my code to work, but I was just wondering why the earth spins with the orbit. I tried it on a practice website I have, and only the orbit spins. How do I make the earth spain with its orbit?

// Here is my code
#mainTitle {
         color: rgba(200, 200, 200,0.5);
         text-align: center;
     font-size: 5em;
}
body {
    background-color: black;
}
#sun {

    border-radius: 50%;
    background-color: #FFFF00;
    height: 100px;
    width: 100px;
    position: absolute;
    top: 50%;
    left: 50%;
    box-shadow: 0 0 100px yellow;
}
#earth {
    border-radius: 100%;
    background-color: #0000EE;
    height: 50px;
    width: 50px;
    position:absolute;
    top:30%;
    left:40%;
}
#orbit{
    border-radius:50%;
    position: absolute;
    top: 50%;
    left: 50%;
    border-width: 2px;
    border-style: dotted;
    border-color: white;
    width: 500px;
    height: 500px;
    margin-top: -200px;
    margin-left: -200px;

    -webkit-animation: spin-right 10s linear infinite;
 -moz-animation: spin-right 10s linear infinite;
  -ms-animation: spin-right 10s linear infinite;
   -o-animation: spin-right 10s linear infinite;
      animation: spin-right 10s linear infinite;
}
@-webkit-keyframes spin-right {
  100% {
    -webkit-transform: rotate(360deg);
   -moz-transform: rotate(360deg);
    -ms-transform: rotate(360deg);
     -o-transform: rotate(360deg);
        transform: rotate(360deg);
  }
}

@keyframes spin-right {
  100% {
-webkit-transform: rotate(360deg);
   -moz-transform: rotate(360deg);
    -ms-transform: rotate(360deg);
     -o-transform: rotate(360deg);
        transform: rotate(360deg);
  }
}

0 votes

permalink

If you're wondering why the Earth spins as it does so, listen to ForrestFire101's "The Duck Song". It tells you why the Earth moves as it does.

887 points
53936e64548c35cd6a002180_628253785
Submitted by
Wafzal2P/Risviltsov/Defeating_The_Be
almost 3 years ago