太阳系主要利用定位,伪元素

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
* {
padding: 0;
margin: 0;
} html, body {
width: 100%;
height: 100%;
overflow: hidden;
} body {
background-color: #000;
} .sun {
width: 80px;
height: 80px;
border-radius: 50%;
position: absolute;
top: 50%;
left: 50%;
margin-left: -40px;
margin-top: -40px;
background-color: orange;
box-shadow: 0px 0px 30px 2px yellow;
} .earth {
width: 300px;
height: 300px;
border-radius: 50%;
position: absolute;
top: 50%;
left: 50%;
margin-left: -150px;
margin-top: -150px;
border: 1px solid #fff;
animation: gun 10s infinite linear;
} .earth::before {
content: "";
position: absolute;
width: 40px;
height: 40px;
top: 50%;
margin-top: -20px;
left: -20px;
border-radius: 50%;
background-color: blue;
} .moon {
position: absolute;
width: 100px;
height: 100px;
top: 50%;
margin-top: -50px;
left: -50px;
border-radius: 50%;
/*border: 1px solid #fff;*/
animation: gun 2.5s infinite linear;
} .moon:before {
content: "";
position: absolute;
width: 18px;
height: 18px;
top: 50%;
margin-top: -9px;
left: -9px;
border-radius: 50%;
background-color: silver;
} .mars {
width: 460px;
height: 460px;
border-radius: 50%;
position: absolute;
top: 50%;
left: 50%;
margin-left: -230px;
margin-top: -230px;
border: 1px solid #fff;
animation: gun 15s infinite linear;
} .mars::before {
content: "";
position: absolute;
width: 50px;
height: 50px;
top: 50%;
margin-top: -25px;
left: -25px;
border-radius: 50%;
background-color: orange;
} .venus {
width: 600px;
height: 600px;
border-radius: 50%;
position: absolute;
top: 50%;
left: 50%;
margin-left: -300px;
margin-top: -300px;
border: 1px solid #fff;
animation: gun 20s infinite linear;
} .venus::before {
content: "";
position: absolute;
width: 60px;
height: 60px;
top: 50%;
margin-top: -30px;
left: -30px;
border-radius: 50%;
background-color: silver;
} @keyframes gun {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
</style>
</head>
<body>
<div class="sun"></div>
<div class="earth">
<div class="moon"></div>
</div>
<div class="mars"></div>
<div class="venus"></div>
</body>
</html>

参考资料:cssRules  js操作cssRules

html5——动画案例(太阳系)的更多相关文章

  1. html5——动画案例(时钟)

    1.秒钟转360度需要60s分60步 2.分针转360度需要3600s分60步 3.秒钟转360度需要43200s分60步 <!DOCTYPE html> <html lang=&q ...

  2. html5——动画案例(无缝滚动)

    无缝滚动:是两组拼在一起的 <!DOCTYPE html> <html lang="en"> <head> <meta charset=& ...

  3. html5——动画案例(大海)

    太阳的发散效果主要是利用transform: scale(1.3),将物体变大 <!DOCTYPE html> <html lang="en"> <h ...

  4. 精选19款华丽的HTML5动画和实用案例

    下面是本人收集的19款超酷HTML5动画和实用案例,觉得不错,分享给大家. 1.HTML5 Canvas火焰喷射动画效果 还记得以前分享过的一款HTML5烟花动画HTML5 Canvas烟花特效,今天 ...

  5. 使用css3的动画模拟太阳系行星公转

    本文介绍使用css3的animation画一个太阳系行星公转的动画,再加以改进,讨论如何画椭圆的运行轨迹.然后分析京东和人人网使用animation的实际案例,最后结合css3的clip-path做一 ...

  6. HTML5 动画效果的多种实现方式

    HTML5 动画效果的多种实现方式 1.  CSS3 transform + transition https://www.w3.org/TR/css-transforms-1/ https://ww ...

  7. 给你推荐10款优秀的 HTML5 动画工具

    HTML5 在过去三年快速增长,已经成为 Web 开发人员最喜欢的编程语言之一.强大的编程语言拥有开发更好的网页应用的能力. HTML5 中引入的新技术都非常好,像 Chrome.Firefox.Sa ...

  8. HTML5 Maker – 在线轻松制作 HTML5 动画效果

    HTML5 Maker 是一个在线动画制作工具,帮助你使用 HTML,CSS 和 JavaScript 创建动态,互动的内容.它非常容易使用,同时可以帮你实现非常好的效果.它可以制作跨浏览器的动画内容 ...

  9. HTML5动画软件工具编辑器 HTML5动画分类 工具推荐

    接下来介绍几款制作HTML5动画的工具,它们可以分为几类: 1.导出canvas动画: Flash CC(13.1).Animation.Radi 2.导出DIV+CSS3动画: HTML5 Make ...

随机推荐

  1. PHP rand()和mt_rand()的区别

    rand()和mt_rand()作用都是产生一个随机整数,都有两种使用形式: 1.int rand(void) / int mt_rand(void) 2.int rand(int $min, int ...

  2. P - FatMouse and Cheese 记忆化搜索

    FatMouse has stored some cheese in a city. The city can be considered as a square grid of dimension ...

  3. 非常适合新手的jq/zepto源码分析04

    $.extend = function(target){ var deep, args = slice.call(arguments, 1) if (typeof target == 'boolean ...

  4. laravel5.5更新到laravel5.7

    为什么要更新呢?因为项目用的第三方后台扩展包,有很些bug,不够完美.想要一个漂亮的后台,那个后台只支持5.7. 然后,我就开始更新框架了. 修改后:"php": "&g ...

  5. NetCore实现全局异常捕捉统一处理

    做net项目时候,在Global.asax文件中可以通过Application_Error方法全局捕获异常并处理后统一跳转到自定义的错误页面. 下面是我个人在NetCore项目中实现全局捕获异常并统一 ...

  6. 古代password

    古代password 个人信息:就读于燕大本科软件project专业 眼下大三; 本人博客:google搜索"cqs_2012"就可以; 个人爱好:酷爱数据结构和算法.希望将来从事 ...

  7. IOS - 设置与帮助界面

    设置与帮助 改动头像, 改动password, 移动客服, 帮助, 声明, 关于我们. 代码 // // IndexSetting600ViewController.h // SymptomCheck ...

  8. 深入理解 JBoss 7/WildFly Domain 模式启动过程

    概述 JBoss 7/WildFly 以 domain 模式启动时会启动多个 JVM.比如例如以下通过启动脚本启动 domain 模式: ./domain.sh 启动后我们查看进程: [kylin@l ...

  9. 进程同步与相互排斥:POSIX有名信号量

    在 POSIX 标准中,信号量分两种,一种是无名信号量,一种是有名信号量. 无名信号量一般用于线程间同步或相互排斥,而有名信号量一般用于进程间同步或相互排斥. 它们的差别和管道及命名管道的差别类似.无 ...

  10. cts帧

     RTS/CTS机制的工作原理是.发送网站在向接收网站发送数据包之前.即在DIFS之后不是马上发送数据,而是代之以发送一个请求发送RTS(Ready To Send)帧,以申请对介质的占用,当接收 ...