css简单实现火焰效果
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" href="flame.css"/>
<style>
/*清除边距*/
body, div {
margin: 0;
padding: 0;
}
/*设置背景色*/
body {
background: #000;
} .flame {
width: 300px;
height: 300px;
margin: 200px auto;
/*background: #FFFFFF;*/
position: relative;
}
/*火焰效果,用简单div实现*/
.flame div:nth-child(-n+6) {
width: 0px;
height: 0px;
background: #D81818;
border-radius: 20%;
transform: rotateZ(45deg);
position: absolute;
left: 45%;
top: 60%;
} .flame div:nth-child(1) {
animation: gun 6s linear Infinite;
} .flame div:nth-child(2) {
animation: gun1 6s linear Infinite;
animation-delay: 1s;
} .flame div:nth-child(3) {
animation: gun 6s linear Infinite;
animation-delay: 2s;
}
.flame div:nth-child(4) {
animation: gun1 6s linear Infinite;
animation-delay: 3s;
}
.flame div:nth-child(5) {
animation: gun 6s linear Infinite;
animation-delay:4s;
}
.flame div:nth-child(6) {
animation: gun1 6s linear Infinite;
animation-delay:5s;
}
/*添加伪类元素实现火花效果*/
.flame1::before {
content: "";
width: 0px;
height: 0px;
background: #FFC001;
border-radius: 50%;
transform: rotateZ(45deg);
position: absolute;
left: 45%;
top: 60%;
animation: gun2 4s ease-in Infinite;
animation-delay: 1s;
background: radial-gradient(
5px at center,
red,
#FFC001
)
}
.flame3::before {
content: "";
width: 0px;
height: 0px;
background: #FFC001;
border-radius: 50%;
transform: rotateZ(45deg);
position: absolute;
left: 45%;
top: 60%;
animation: gun2 4s ease-in Infinite;
animation-delay: 3s;
background: radial-gradient(
5px at center,
red,
#FFC001
)
}
.flame5::before {
content: "";
width: 0px;
height: 0px;
background: #FFC001;
border-radius: 50%;
transform: rotateZ(45deg);
position: absolute;
left: 45%;
top: 60%;
animation: gun2 4s ease-in Infinite;
animation-delay: 6s;
background: radial-gradient(
5px at center,
red,
#FFC001
)
}
/*设置动画实现火焰上升*/
@keyframes gun {
0% {
width: 10px;
height: 10px;
transform: translateY(0px) translateX(0px) rotateZ(45deg);
}
100% {
width: 40px;
height: 40px;
transform: translateY(-200px) translateX(-30px) rotateZ(45deg);
opacity:0.2;
}
} @keyframes gun1 {
0% {
width: 10px;
height: 10px;
transform: translateY(0px) translateX(0px) rotateZ(45deg);
}
100% {
width: 40px;
height: 40px;
transform: translateY(-200px) translateX(30px) rotateZ(45deg);
opacity:0.2;
}
} @keyframes gun2 {
0% {
width: 3px;
height: 3px;
transform: translateY(0px) translateX(0px) rotateZ(45deg);
}
50%{
width: 5px;
height: 5px;
transform: translateY(-130px) translateX(-30px) rotateZ(45deg);
}
100% {
width: 5px;
height: 5px;
transform: translateY(-200px) translateX(-70px) rotateZ(45deg);
}
}
/*树枝*/
.branch1, .branch2 {
width: 260px;
height: 20px;
background: #DB4732;
position: absolute;
top: 80%;
left: 8%;
} .branch1 {
transform: rotateZ(15deg);
} .branch2 {
transform: rotateZ(-15deg);
}
</style>
</head>
<body>
<div class="flame">
<div class="flame1"></div>
<div class="flame2"></div>
<div class="flame3"></div>
<div class="flame4"></div>
<div class="flame5"></div>
<div class="flame6"></div>
<div class="flame7"></div>
<div class="flame8"></div>
<div class="branch1"></div>
<div class="branch2"></div>
</div>
</body>
</html>
这是一个简单用css+div布局实现的火焰效果,在网上看到觉得挺有趣,也比较美观,所以模仿一下。
这里没有用任何的js代码,仅用css动画等相关技术就可以实现。
css简单实现火焰效果的更多相关文章
- css3 calc():css简单的数学运算-加减乘除
css3 calc():css简单的数学运算–加减乘除 多好的东西啊,不用js,一个css就解决了. .box{ border:1px solid #ddd; width:calc(100% - 10 ...
- HTML与CSS简单页面效果实例
本篇博客实现一个HTML与CSS简单页面效果实例 index.html <!DOCTYPE html> <html> <head> <meta charset ...
- CSS简单使用
CSS简单使用 标签 : 前端技术 CSS(Cascading Style Sheet : 层叠样式表单)用来定义网页显示效果. 可以解决HTML代码对样式定义的重复,提高后期样式代码的可维护性,并增 ...
- 前端学习日记之HTML、CSS 简单总结
前端学习日记之HTML.CSS 简单总结 标签(空格分隔): html css 前端学习日记 html超文本标记语言 一. h标题标签 h1-h7 <!DOCTYPE html> < ...
- css简单实现带箭头的边框
原文地址 https://tianshengjie.cn/artic... css简单实现带箭头的边框 普通边框 <style> .border { width: 100px; heigh ...
- 3.8.1 HTML与CSS简单页面效果实例
HTML与CSS简单页面效果实例 <!DOCTYPE html> <html> <head> <meta charset="utf-8" ...
- 有趣的css—简单的下雨效果2.0版
简单的下雨效果2.0版 前言 笔者上一篇发布的文章有趣的css-简单的下雨效果中有位老哥给我提了一个很棒的建议,大致意思是波纹应该产生于雨滴的消失处. 这是按照老哥的建议完善后的效果图: 由于我制作G ...
- jQuery+CSS 简单代码实现遮罩层( 兼容主流浏览器 )
/* ** jQuery版本:jQuery-1.8.3.min.js ** 浏览器:Chrome( v31.0.1650.63 m ),IE11,Firefox( v32.0.1 ),IETester ...
- JS+CSS简单实现DIV遮罩层显示隐藏【转藏】
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
随机推荐
- qppium 原理解析
Appium是 c/s模式的appium是基于 webdriver 协议添加对移动设备自化api扩展而成的webdriver 是基于 http协议的,第一连接会建立个 session 会话,并通过 p ...
- ROM与RAM知识
“ROM”和“RAM”的意思: “ROM”:N年前代表一种只能写入和读取,而不能改写和擦除的设备,可以用光驱CD-ROM来说明这个道理.目前的“ROM”已经不是这个道理了,它的技术已经飞快的发展到现在 ...
- BZOJ 4085:[Sdoi2015]bigyration(SDOI 2015 round 2 Day 1)
别人家的神选系列.Day2根本不能做QAQ 题目描述:给定两个字符串集合,一个长度为n,另一个为m,求有多少个数字对i,j,满足xi+yj能由一个(n+m)/2的字符串旋转拼接而成 我们枚举长度较长的 ...
- Error: Cannot find module 'gulp-clone'问题的解决
安装完gulp环境,并且配置好gulpfile.js,执行静态文件压缩和代码混淆时,出现如下错误: Error: Cannot find module 'gulp-clone' Error: Cann ...
- 关于echarts的一些基本使用demo
最近发现一个很好用的一个前端控件echarts,效果非常不错,兼容ie8+以上等主流浏览器.可以使用它制作报表,地图示意图等,可用其实现一系列强大的功能. 其基于html5 Canvas,是一个纯Ja ...
- Material Design学习-----TextInputLayout
TextInputLayout是为EditText提供了一种新的实现和交互方式.在传统的EditText中存在一个hint属性,是说在editext中没有内容时,默认的提示信息.当想edittext中 ...
- VUE2.0实现购物车和地址选配功能学习第七节
第七节 卡片选中,设置默认 1.卡片选中html:<li v-for="(item,index) in filterAddress" v-bind:class="{ ...
- 深入理解Node系列-细说Connect(上)
前言 想必对于广大前后端的同学们,Node 或是用来作为网站服务器的搭建,亦或是用来作为开发脚手架的运用,或是早有套路,亦或是浅尝辄止.从现在开始博主将会不定时的对 Node 系列的产品做分析,其中夹 ...
- Visual Studio 2017离线安装包,百度云分流
Visual Studio正式版发布了,然而只能在线安装.虽然官方有提供了离线的方法,但还是蛮复杂的,所以我打包了两个版本发布至百度云分享. 离线分流 地址:http://pan.baidu.com/ ...
- how to use Prolog in C#? SWI-Prolog
上个月突然看到Prolog这门语言,它特殊的语法吸引了我,但是经过我一段时间的学习,发现它也不像网络上传说的那样神奇,不过我依然对它很感兴趣,有前辈说Prolog本身并不强大,但是用来作为一门辅助语言 ...