Planet orbiting around sun

An example showing how to create planet orbiting around sun using Tizen 2.3.
<style>
  @keyframes clockwise {
    from {
      transform: rotate(0deg);
    }
    to {
      transform: rotate(360deg);
    }
  }
  
  @keyframes anticlockwise {
    from {
      transform: rotate(0deg);
    }
    to {
      transform: rotate(-360deg);
    }
  }
  
  .space {
    position: absolute;
    left: 100px;
    top: 100px;
  }
  
  .orbit {
    position: absolute;
    animation: anticlockwise 6s linear infinite;
    transform-origin: 200px 200px;
  }
  
  .sun {
    position: absolute;
    width: 100px;
    height: 100px;
    margin-left: -50px;
    margin-top: -50px;
    transform: translate(200px, 200px);
    border-radius: 50%;
    background: orange;
  }
  
  .planet {
    position: absolute;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: lightblue;
    animation: clockwise 6s linear infinite;
  }
</style>
<div class="space">
  <div class="sun"></div>
  <div class="orbit">
    <div class="planet"></div>
  </div>
</div>

Responses

0 Replies