Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

Sorry, you do not have permission to ask a question, You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please type your username.

Please type your E-Mail.

Please choose an appropriate title for the post.

Please choose the appropriate section so your post can be easily searched.

Please choose suitable Keywords Ex: post, video.

Browse

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Logo Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Logo

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Navigation

  • Home
  • About Us
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • About Us
  • Contact Us
Home/ Questions/Q 427

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Latest Questions

Author
  • 62k
Author
Asked: November 25, 20242024-11-25T10:46:07+00:00 2024-11-25T10:46:07+00:00

Moon Rotating Around Earth CSS Animation

  • 62k

CSS animation is a technique by which you can add some effects to various elements of your website. CSS animation is a game changer for those just starting out in web design. It is a creative tool of web design through which you can showcase your skills and present your website in a unique way from other websites. In today's blog, we will share a simple yet interesting CSS snippet. Today we will do the moon's rotation around the earth animation. Everything you need to do to create this snippet is detailed in the video tutorial below.

CSS animations not only make a design look beautiful but also make a website more lively and interactive. Also, CSS animations added to the website also help to attract the attention of the users. Those practicing web design can create beautiful CSS animations without using complex code like JavaScript. Since the advent of CSS3, many complex JavaScript animations can now be created with CSS.

You May Like These:

Bootstrap 5 Landing Page Design
Logo Slider using HTML CSS
Bootstrap 5 Slider with Text Animation
Bootstrap Carousel With Thumbnails

In our CSS animation snippet, we created a moon-earth rotation animation using CSS keyframe animation. To give a star effect, I took four divs and spread them around with the CSS position attribute. Separate animation properties are set for star moon and earth animation. This 2D rotation animation of the Earth and Moon uses CSS transform translate and rotate functions. Opacity is used for the twinkling star effect.

ADD HTML:

<!DOCTYPE html> <html lang="en">     <!-- divinectorweb.com --> <head>     <meta charset="UTF-8">     <meta name="viewport" content="width=device-width, initial-scale=1.0">     <title>css Rotating moon around earth Animation</title>     <link rel="stylesheet" href="style.css"> </head> <body>     <div class="wrapper">         <div class="earth"></div>         <div class="moon"></div>         <!-- Generate more random stars if you want-->         <div class="star" style="top: 10%; left: 20%;"></div>         <div class="star" style="top: 40%; left: 70%;"></div>         <div class="star" style="top: 60%; left: 30%;"></div>         <div class="star" style="top: 80%; left: 80%;"></div>     </div> </body> </html> 
Enter fullscreen mode Exit fullscreen mode

ADD CSS:

body {     margin: 0;     overflow: hidden; } .wrapper {     width: 100vw;     height: 100vh;     background-color: #000;     position: relative; } .earth {     width: 200px;     height: 200px;     border-radius: 50%;     background: url('earth.png');     background-size: cover;     position: absolute;     top: 50%;     left: 50%;     transform: translate(-50%, -50%);     animation: ani-3 15s linear infinite; } .moon {     width: 60px;     height: 60px;     background: url('moon.png');     background-size: cover;     position: absolute;     top: 50%;     left: 50%;     animation: ani-1 7s linear infinite; } .star {     width: 5px;     height: 5px;     background-color: #fff;     position: absolute;     animation: ani-2 2s linear infinite; } @keyframes ani-3 {     0% {         transform: translate(-50%, -50%) rotate(0deg);     }     100% {         transform: translate(-50%, -50%) rotate(360deg);     } } @keyframes ani-1 {     0% {         transform: translate(-50%, -50%) rotate(0deg) translateX(100px) rotate(0deg);     }     100% {         transform: translate(-50%, -50%) rotate(360deg) translateX(100px) rotate(-360deg);     } } @keyframes ani-2 {     0%, 100% {         opacity: 1;     }     50% {         opacity: 0;     } } 
Enter fullscreen mode Exit fullscreen mode

For the original blog post
Download code with Images

animationcsshtmlwebdev
  • 0 0 Answers
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

Sidebar

Ask A Question

Stats

  • Questions 4k
  • Answers 0
  • Best Answers 0
  • Users 1k
  • Popular
  • Answers
  • Author

    How to ensure that all the routes on my Symfony ...

    • 0 Answers
  • Author

    Insights into Forms in Flask

    • 0 Answers
  • Author

    Kick Start Your Next Project With Holo Theme

    • 0 Answers

Top Members

Samantha Carter

Samantha Carter

  • 0 Questions
  • 20 Points
Begginer
Ella Lewis

Ella Lewis

  • 0 Questions
  • 20 Points
Begginer
Isaac Anderson

Isaac Anderson

  • 0 Questions
  • 20 Points
Begginer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help

Footer

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise

Querify Question Shop: Explore, ask, and connect. Join our vibrant Q&A community today!

About Us

  • About Us
  • Contact Us
  • All Users

Legal Stuff

  • Terms of Use
  • Privacy Policy
  • Cookie Policy

Help

  • Knowledge Base
  • Support

Follow

© 2022 Querify Question. All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.