This time I will show you how to use h5 and c3 to create the animation effect of the planets in the solar system. What are the precautions for using h5 and c3 to create the animation effect of the planets in the solar system? The following is a practical case. Let’s take a look.
Make an animation of the movement of the eight planets in the solar system, excluding the satellites of the planets. All planets revolve around the sun. The planets use solid colors and have no rotation for the time being. The animation includes: the sun and planets, their orbits, and planetary revolution animations. First draw a sketch, design the size and position, and calculate the animation execution time based on the revolution period. The structure of html:A div with class solarsys, as the solar system container element, the position of the div is relative. Planetary orbits and planets use div, and the position is absolute. The container uses relative and the internal elements use absolute positioning. It is relatively simple to achieve the effect. The disadvantage is that the size is fixed.<div class="solarsys"> <!--太阳--> <div class='sun'></div> <!--水星轨道--> <div class='mercuryOrbit'></div> <!--水星--> <div class='mercury'></div> <!--金星轨道--> <div class='venusOrbit'></div> <!--金星--> <div class='venus'></div> <!--地球轨道--> <div class='earthOrbit'></div> <!--地球--> <div class='earth'></div> <!--火星轨道--> <div class='marsOrbit'></div> <!--火星--> <div class='mars'></div> <!--木星轨道--> <div class='jupiterOrbit'></div> <!--木星--> <div class='jupiter'></div> <!--土星轨道--> <div class='saturnOrbit'></div> <!--土星--> <div class='saturn'></div> <!--天王星轨道--> <div class='uranusOrbit'></div> <!--天王星--> <div class='uranus'></div> <!--海王星轨道--> <div class='neptuneOrbit'></div> <!--海王星--> <div class='neptune'></div> </div>
.solarsys{ width: 800px; height: 800px;; position: relative; margin: 0 auto; background-color: #000000; padding: 0; transform: scale(1); }
.sun { left:357px; top:357px; height: 90px; width: 90px; background-color: rgb(248,107,35); border-radius: 50%; box-shadow: 5px 5px 10px rgb(248,107,35), -5px -5px 10px rgb(248,107,35), 5px -5px 10px rgb(248,107,35), -5px 5px 10px rgb(248,107,35); position: absolute; margin: 0; }
.mercuryOrbit { left:342.5px; top:342.5px; height: 115px; width: 115px; background-color: transparent; border-radius: 50%; border-style: dashed; border-color: gray; position: absolute; border-width: 1px; margin: 0px; padding: 0px; }
About how to operate scroll bars in HTML
htmlHow to make thin line tables
What are the display modes of html block-level tags, inline tags, and inline block tags
The above is the detailed content of How to create animation effects of the planets in the solar system with h5 and c3. For more information, please follow other related articles on the PHP Chinese website!