html5——动画案例(太阳系)
太阳系主要利用定位,伪元素
<!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——动画案例(太阳系)的更多相关文章
- html5——动画案例(时钟)
1.秒钟转360度需要60s分60步 2.分针转360度需要3600s分60步 3.秒钟转360度需要43200s分60步 <!DOCTYPE html> <html lang=&q ...
- html5——动画案例(无缝滚动)
无缝滚动:是两组拼在一起的 <!DOCTYPE html> <html lang="en"> <head> <meta charset=& ...
- html5——动画案例(大海)
太阳的发散效果主要是利用transform: scale(1.3),将物体变大 <!DOCTYPE html> <html lang="en"> <h ...
- 精选19款华丽的HTML5动画和实用案例
下面是本人收集的19款超酷HTML5动画和实用案例,觉得不错,分享给大家. 1.HTML5 Canvas火焰喷射动画效果 还记得以前分享过的一款HTML5烟花动画HTML5 Canvas烟花特效,今天 ...
- 使用css3的动画模拟太阳系行星公转
本文介绍使用css3的animation画一个太阳系行星公转的动画,再加以改进,讨论如何画椭圆的运行轨迹.然后分析京东和人人网使用animation的实际案例,最后结合css3的clip-path做一 ...
- HTML5 动画效果的多种实现方式
HTML5 动画效果的多种实现方式 1. CSS3 transform + transition https://www.w3.org/TR/css-transforms-1/ https://ww ...
- 给你推荐10款优秀的 HTML5 动画工具
HTML5 在过去三年快速增长,已经成为 Web 开发人员最喜欢的编程语言之一.强大的编程语言拥有开发更好的网页应用的能力. HTML5 中引入的新技术都非常好,像 Chrome.Firefox.Sa ...
- HTML5 Maker – 在线轻松制作 HTML5 动画效果
HTML5 Maker 是一个在线动画制作工具,帮助你使用 HTML,CSS 和 JavaScript 创建动态,互动的内容.它非常容易使用,同时可以帮你实现非常好的效果.它可以制作跨浏览器的动画内容 ...
- HTML5动画软件工具编辑器 HTML5动画分类 工具推荐
接下来介绍几款制作HTML5动画的工具,它们可以分为几类: 1.导出canvas动画: Flash CC(13.1).Animation.Radi 2.导出DIV+CSS3动画: HTML5 Make ...
随机推荐
- 疫情控制(codevs 1218)
题目描述 Description H 国有 n 个城市,这 n 个城市用 n-1 条双向道路相互连通构成一棵树,1 号城市是首都, 也是树中的根节点. H 国的首都爆发了一种危害性极高的传染病.当局为 ...
- 使用ajax,后台传回的数据处理
使用ajax,后台传到前台的是json数据,但这只是一个字符串的形式,需要进行转换为对象 转换后再使用$.each()方法进行遍历 使用alert(typeof msg) ; 可以查看msg的类型 ...
- AbstractList 重写 equals() 方法
题目内容 题目内容很简单,就是创建 ArrayList 和 Vector 集合,向两者添加相同内容的字符串,最后用 equals() 方法比较是否相等. 这里就考察了 "==" 和 ...
- SiteMesh基础教程
SiteMesh是由一个基于Web页面布局.装饰以及与现存Web应用整合的框架.它能帮助我们在由大量页面构成的项目中创建一致的页面布局和外观,如一致的导航条,一致的banner,一致的版权,等等. 教 ...
- Python&MySQL
环境:windows8+Python2.7+MySQL5.6 尝试过在C/C++中嵌入SQL语言,最终在其复杂"繁琐"环境配置中败下阵来,后来发现Python和MySQL比較eas ...
- LeetCode 237. Delete Node in a Linked List (在链表中删除一个点)
Write a function to delete a node (except the tail) in a singly linked list, given only access to th ...
- java学习笔记:Eclipse打开现有项目
初学JAVA,觉得困难重重. 多年来,已经习惯了微软系列的VS,现在使用Eclipse,觉得差别很大. 比如打开一个现有项目.并没有什么所谓的项目文件,如*.sln,*.cproj什么的.那怎么打开? ...
- Selenium中配置链接使用FTP服务
Enable the default report solution Step1: Create a suite listener and add codes into it, please watc ...
- Ubuntu 查看当前目录使用的总空间大小
查看当前目录使用的总空间大小 du -h --max-depth=0 #du -h --max-depth=0 217M . 查看当前目录使用总空间的大小以及当前目录下一级文件及文件夹各自使用的总空间 ...
- bzoj1494
这道题不仅得看俞华程的论文,还得看陈丹琦的论文,否则是不可能做出来的.因为难点在构造矩阵上. 构造矩阵困难在如何表示状态,因为树不能有环,也不能不连通,这里我们引入了最小表示法来表示连续k个点的连通性 ...