CSS 绘制太阳系行星运行轨迹

本文详细介绍了如何利用CSS的特性,结合HTML结构,创建一个动态展示太阳系行星运动轨迹的效果。通过设置动画和变换属性,使得行星沿着各自的椭圆轨道缓缓旋转,呈现宇宙的壮丽景象。
摘要由CSDN通过智能技术生成
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>CSS3 动画</title>
    <style>
        div.ex1{
   
            width: 100px;
            height: 100px;
            background: red;
            animation: myfirst 5s;
            -webkit-transition: myfirst 5s;
        }

        @keyframes myfirst {
   
            from{
   background: red}
            to{
   background: yellow}

        }

        @-webkit-keyframes myfirst {
   
            from{
   background: red}
            to{
   background: yellow}
        }


        div.ex2{
   
            width: 100px;
            height: 100px;
            background: red;
            animation: myfirst2 5s;
            -webkit-transition: myfirst2 5s;
            -moz-animation: myfirst2 5s;
            -o-animation: myfirst2 5s;
        }

        @keyframes myfirst2 {
   
            0%{
   background: red;}
            25%{
   background: yellow;}
            50%{
   background: blue;}
            100%{
   background: green;}
        }

        @-webkit-keyframes myfirst2 {
   
            0%{
   background: red;}
            25%{
   background: yellow;}
            50%{
   background: blue;}
            100%{
   background: green;}
        }

        @-moz-keyframes myfirst2 {
   
            0%{
   background: red;}
            25%{
   background: yellow;}
            50%{
   background: blue;}
            100%{
   background: green;}
        }

        @-o-keyframes myfirst2 {
   
            0%{
   background: red;}
            25%{
   background: yellow;}
            50%{
   background: blue;}
            100%{
   background: green;}
        }

        div.ex3{
   
            width: 100px;
            height: 100px;
            background: red;
            position: relative;
            animation: myfirst3 5s;
            -webkit-animation: myfirst3 5s;
        }


        @keyframes myfirst3 {
   
            0%{
   background: red; left: 0px;
                top: 0px;}
            25%{
   background: yellow; left: 200px;
                top: 0px;}
            50%{
   background: blue; left: 200px;
                top: 200px;}
            75%{
   background: green; left: 0px;
                top: 200px;}
            100%{
   background: red; left: 0px;
                top: 0px;}
        }

        @-webkit-keyframes myfirst3 {
   
            0%{
   background: red; left: 0px;
                top: 0px;}
            25%{
   background: yellow; left: 200px;
                top: 0px;}
            50%{
   background: blue; left: 200px;
                top: 200px;}
            75%{
   background: green; left: 0px;
                top: 200px;}
            100%{
   background: red; left: 0px;
                top: 0px;}
        }


        div.ex4{
   
            width: 100px;
            height: 100px;
            background: red;
            position: relative;
            animation-name: myfirst4;
            animation-duration: 5s;
            animation-timing-function: linear;
            animation-delay: 2s;
            animation-iteration-count: infinite;
            animation-direction: alternate;
         
  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值