2016-06-22 2 views
0

Как сделать больше планет вращаться вокруг моего солнца? У меня есть солнце посередине, земля крутится вокруг него, и я хочу вращать меркурий вокруг него, как и на правой полосе, очевидно, между солнцем и землей. Проблема в том, что я не знаю, почему она не создает свою собственную орбиту. Я следую учебному курсу из learntocode, но он оставляет меня, чтобы закончить его, хотя я считаю, что это действительно сложно. На моем веб-сайте он не вращается, но в моей скрипке это происходит? Какие?Сделать больше планет орбиты

https://jsfiddle.net/4rdyg8tj/

http://planets.lucavanraalte.com/

HTML:

<body> 
<!-- Right below is an image of the sun --> 
<img id="sun" src="http://i.imgur.com/C8lLjeM.png"> 

<!-- Insert the 'earth' on the next line --> 
<div id='earth-orbit'> 
<img id="earth" src="http://i.imgur.com/XeueGf6.png"> 
</div> 

<div id='mercurius-orbit'> 
<img id="mercurius" src="http://i.imgur.com/06XMdvX.png"> 
</div> 


</body> 
</html> 

Css:

html, body { 
/* The universe takes up all available space */ 
width: 100%; 
height: 100%; 

/* The universe is black */ 
background-color: black; 
} 

#sun { 
position: absolute; 
top: 50%; 
left: 50%; 

height: 200px; 
width: 200px; 
margin-top: -60px; 
margin-left: -60px; 

border-color: orange; 
border-width: 8px; 
border-style: solid; 
border-radius: 50%; 

box-shadow: 0 0 128px red; 
} 

#earth { 
position: absolute; 
top: 0; 
left: 50%; 

height: 50px; 
width: 50px; 
margin-left: -25px; 
margin-top: -25px; 
} 

#mercurius { 
position: absolute; 
top: 0; 
left: 50%; 

height: 50px; 
width: 50px; 
margin-left: -25px; 
margin-top: -25px; 
} 

#earth-orbit { 
position: absolute; 
top: 50%; 
left: 50%; 

width: 600px; 
height: 600px; 
margin-top: -250px; 
margin-left: -250px; 

border-width: 2px; 
border-style: dotted; 
border-color: white; 
border-radius: 50%; 

-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; 
} 

#mercurius-orbit { 
position: absolute; 
top: 50%; 
left: 50%; 

width: 400px; 
height: 400px; 
margin-top: -250px; 
margin-left: -250px; 

border-width: 2px; 
border-style: dotted; 
border-color: white; 
border-radius: 50%; 

-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

Он вращается на странице тоже. –

+0

Теперь он делает, я исправил его – Lucafraser

+0

«Eppur si muove!» Galileo Galilei – pavelccz

ответ

0

Отредактировано с различными позициями планет

html, body { 
 
    /* The universe takes up all available space */ 
 
    width: 100%; 
 
    height: 100%; 
 

 
    /* The universe is black */ 
 
    background-color: black; 
 
} 
 

 
#sun { 
 
    position: absolute; 
 
    top: 50%; 
 
    left: 50%; 
 

 
    height: 200px; 
 
    width: 200px; 
 
    margin-top: -60px; 
 
    margin-left: -60px; 
 

 
    border-color: orange; 
 
    border-width: 8px; 
 
    border-style: solid; 
 
    border-radius: 50%; 
 

 
    box-shadow: 0 0 128px red; 
 
} 
 

 
#earth { 
 
    position: absolute; 
 
    top: 0; 
 
    left: 50%; 
 

 
    height: 50px; 
 
    width: 50px; 
 
    margin-left: -25px; 
 
    margin-top: -25px; 
 
} 
 

 
#mercurius { 
 
    position: absolute; 
 
    bottom: 40%; 
 
    height: 30px; 
 
    width: 30px; 
 
    right: 96%; 
 
} 
 

 
#earth-orbit { 
 
    position: absolute; 
 
    top: 50%; 
 
    left: 50%; 
 

 
    width: 600px; 
 
    height: 600px; 
 
    margin-top: -250px; 
 
    margin-left: -250px; 
 

 
    border-width: 2px; 
 
    border-style: dotted; 
 
    border-color: white; 
 
    border-radius: 50%; 
 

 
    -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; 
 
} 
 

 
#mercurius-orbit { 
 
    position: absolute; 
 
    top: 50%; 
 
    left: 50%; 
 

 
    width: 400px; 
 
    height: 400px; 
 
    margin-top: -150px; 
 
    margin-left: -150px; 
 

 
    border-width: 2px; 
 
    border-style: dotted; 
 
    border-color: white; 
 
    border-radius: 50%; 
 

 
    -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); 
 
    } 
 
}
<html> 
 
<head> 
 
    <link rel="stylesheet" href="style.css" /> 
 
</head> 
 

 
<body> 
 
<!-- Right below is an image of the sun --> 
 
<img id="sun" src="http://s3.amazonaws.com/codecademy-content/courses/sun-earth-code/sun.png"> 
 

 
<!-- Insert the 'earth' on the next line --> 
 
<div id='earth-orbit'> 
 
    <img id="earth" src="http://i.imgur.com/XeueGf6.png"> 
 
</div> 
 

 
<div id='mercurius-orbit'> 
 
    <img id="mercurius" src="http://i.imgur.com/06XMdvX.png"> 
 
</div>s 
 

 

 
</body> 
 
</html>

+0

Знаете ли вы, как я мог бы начать их отдельно? – Lucafraser

+0

sepeerately ?? вы имеете в виду другую отправную точку? –

+0

см. Я отредактировал ... –

Смежные вопросы