div+css实现蜡烛燃烧动画效果代码
代码语言:html
所属分类:动画
代码描述:div+css实现蜡烛燃烧动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
html, body {
height: 100vh;
background: #000;
overflow: hidden;
}
.g-candle {
position: absolute;
width: 400px;
margin: 0 auto;
height: 400px;
}
.g-body {
position: relative;
width: 100px;
height: 300px;
margin: 280px auto;
background: linear-gradient(230deg, #ca9800, #573903, black 70%);
z-index: 1;
}
.g-body::before {
position: absolute;
content: "";
width: 100px;
height: 40px;
border-radius: 50%;
box-sizing: border-box;
top: -20px;
background: radial-gradient(#a46800, #5c3104 45%, #905602 100%);
}
.g-body::after {
position: absolute;
content: "";
width: 4px;
height: 48px;
background: #fff;
left: 50%;
top: -22px;
transform: translate(-50%, -50%);
border-radius: 50% 50% 0 0;
background: linear-gradient(180deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.8) 60%, #fff);
opacity: 0.7;
filter: blur(1px);
}
.g-fire-box {
position: absolute;
top: 97px;
left: 50%;
width: 80px;
height: 200px;
transform: translate(-50%, -50%);
filter: blur(2px) contrast(20);
}
.g-fire {
position: absolute;
top: 30px;
left: 50%;
border-radius: 45%;
box-sizing: border-box;
border: 120px solid #000;
border-bottom: 120px solid transparent;
transform: translate(-50%, 0) scaleX(0.45);
background-color: #761b00;
}
.g-ball {
position: absolute;
top: 60px;
transform: translate(0, 0);
background: #fa8763;
border-radius: 50%;
z-index: -1;
mix-blend-mode: screen;
}
.g-ball:nth-child(0) {
width: 31px;
height: 31px;
radius: 50% 50%;
left: calc(45px - 55px);
}
.g-ball:nth-child(0) {
animation: movetop 1s linear -0.57s infinite;
}
.g-ball:nth-child(1) {
width: 13px;
height: 13px;
radius: 50% 50%;
left: calc(33px - 55px);
}
.g-ball:nth-child(1) {
animation: movetop 1s linear -2.712s infinite;
}
.g-ball:nth-child(2) {
width: 41px;
height: 41px;
radius: 50% 50%;
left: calc(43px - 55px);
}
.g-ball:nth-child(2) {
animation: movetop 1s linear -1.291s infinite;
}
.g-ball:nth-child(3) {
width: 28px;
height: 28px;
radius: 50% 50%;
left: calc(25px - 55px);
}
.g-ball:nth-child(3) {
animation: movetop 1s linear -2.422s infinite;
}
.g-ball:nth-child(4) {
width: 39px;
height: 39px;
radius: 50% 50%;
left: calc(48px - 55px);
}
.g-ball:nth-child(4) {
animation: movetop 1s linear -0.817s infinite;
}
.g-ball:nth-child(5) {
width: 30px;
height: 30px;
radius: 50% 50%;
left: calc(2px - 55px);
}
.g-ball:nth-child(5) {
animation: movetop 1s linear -0.028s infinite;
}
.g-ball:nth-child(6) {
width: 30px;
height: 30px;
radius: 50% 50%;
left: calc(37px - 55px);
}
.g-ball:nth-child(6) {
animation: movetop 1s linear -2.838s infinite;
}
.g-ball:nth-child(7) {
width: 7px;
height: 7px;
radius: 50% 50%;
left: calc(7px - 55px);
}
.g-ball:nth-child(7) {
animation: movetop 1s linear -2.127s infinite;
}
.g-ball:nth-child(8) {
width: 25px;
height: 25px;
radius: 50% 50%;
left: calc(47px - 55px);
}
.g-ball:nth-child(8) {
animation: movetop 1s linear -1.119s infinite;
}
.g-ball:nth-child(9) {
width: 11px;
height: 11px;
radius: 50% 50%;
left: calc(38px - 55px);
}
.g-ball:nth-child(9) {
animation: movetop 1s linear -0.436s infinite;
}
.g-ball:nth-child(10) {
width: 50px;
height: 50px;
radius: 50% 50%;
left: calc(70px - 55px);
}
.g-ball:nth-child(10) {
animation: movetop 1s linear -2.152s infinite;
}
.g-ball:nth-child(11) {
width: 39px;
height: 39px;
radius: 50% 50%;
left: calc(46px - 55px);
}
.g-ball:nth-child(11) {
animation: movetop 1s linear -2.181s infinite;
}
.g-ball:nth-child(12) {
width: 27px;
height: 27px;
radius: 50% 50%;
left: calc(49px - 55px);
}
.g-ball:nth-child(12) {
animation: movetop 1s linear -2.823s infinite;
}
.g-ball:nth-child(13) {
width: 9px;
height: 9px;
radius: 50% 50%;
left: calc(38px - 55px);
}
.g-ball:nth-child(13) {
animation: movetop 1s linear -1.751s infinite;
}
.g-ball:nth-child(14) {
width: 5px;
height: 5px;
radius: 50% 50%;
left: calc(48px - 55px);
}
.g-ball:nth-child(14) {
animation: movetop 1s linear -2.617s infinite;
}
.g-ball:nth-child(15) {
width: 21px;
height: 21px;
radius: 50% 50%;
left: calc(51px - 55px);
}
.g-ball:nth-child(15) {
animation: movetop 1s linear -1.916s infinite;
}
.g-ball:nth-child(16) {
width: 37px;
height: 37px;
radius: 50% 50%;
left: calc(53px - 55px);
}
.g-ball:nth-child(16) {
animation: movetop 1s linear -1.431s infinite;
}
.g-ball:nth-child(17) {
width: 50px;
height: 50px;
radius: 50% 50%;
left: calc(23px - 55px);
}
.g-ball:nth-child(17) {
animation: movetop 1s linear -1.886s infinite;
}
.g-ball:nth-child(18) {
width: 21px;
height: 21px;
radius: 50% 50%;
left: calc(2px - 55px);
}
.g-ball:nth-child(18) {
animation: movetop 1s linear -0.397s infinite;
}
.g-ball:nth-child(19) {
width: 49px;
height: 49px;
radius: 50% 50%;
left: calc(10px - 55px);
}
.g-ball:nth-child(19) {
animation: movetop 1s linear -2.832s infinite;
}
.g-ball:nth-child(20) {
width: 14px;
height: 14px;
radius: 50% 50%;
left: calc(58px - 55px);
}
.g-ball:nth-child(20) {
animation: movetop 1s linear -2.467s infinite;
}
.g-ball:nth-child(21) {
width: 16px;
height: 16px;
radius: 50% 50%;
left: calc(25px - 55px);
}
.g-ball:nth-child(21) {
animation: movetop 1s linear -1.376s infinite;
}
.g-ball:nth-child(22) {
width: 40px;
height: 40px;
radius: 50% 50%;
left: calc(60px - 55px);
}
.g-ball:nth-child(22) {
animation: movetop 1s linear -0.811s infinite;
}
.g-ball:nth-child(23) {
width: 23px;
height: 23px;
radius: 50% 50%;
left: calc(6px - 55px);
}
.g-ball:nth-child(23) {
animation: movetop 1s linear -0.406s infinite;
}
.g-ball:nth-child(24) {
width: 37px;
height: 37px;
radius: 50% 50%;
left: calc(5px - 55px);
}
.g-ball:nth-child(24) {
animation: movetop 1s linear -2.53s infinite;
}
.g-ball:nth-child(25) {
width: 40px;
height: 40px;
radius: 50% 50%;
left: calc(16px - 55px);
}
.g-ball:nth-child(25) {
animation: movetop 1s linear -1.394s infinite;
}
.g-ball:nth-child(26) {
width: 6px;
height: 6px;
radius: 50% 50%;
left: calc(7px - 55px);
}
.g-ball:nth-child(26) {
animation: movetop 1s linear -1.29s infinite;
}
.g-ball:nth-child(27) {
width: 26px;
height: 26px;
radius: 50% 50%;
left: calc(10px - 55px);
}
.g-ball:nth-child(27) {
animation: movetop 1s linear -2.812s infinite;
}
.g-ball:nth-child(28) {
width: 34px;
height: 34px;
radius: 50% 50%;
left: calc(2px - 55px);
}
.g-ball:nth-child(28) {
animation: movetop 1s linear -2.197s infinite;
}
.g-ball:nth-child(29) {
width: 23px;
height: 23px;
radius: 50% 50%;
left: calc(8px - 55px);
}
.g-ball:nth-child(29) {
animation: movetop 1s linear -2.295s infinite;
}
.g-ball:nth-child(30) {
width: 32px;
height: 32px;
radius: 50% 50%;
left: calc(11px - 55px);
}
.g-ball:nth-child(30) {
animation: movetop 1s linear -0.838s infinite;
}
.g-ball:nth-child(31) {
width: 2px;
height: 2px;
radius: 50% 50%;
left: calc(20px - 55px);
}
.g-ball:nth-child(31) {
animation: movetop 1s linear -1.336s infinite;
}
.g-ball:nth-child(32) {
width: 36px;
height: 36px;
radius: 50% 50%;
left: calc(35px - 55px);
}
.g-ball:nth-child(32) {
animation: movetop 1s linear -0.7s infinite;
}
.g-ball:nth-child(33) {
width: 26px;
height: 26px;
radius: 50% 50%;
left: calc(46px - 55px);
}
.g-ball:nth-child(33) {
animation: movetop 1s linear -0.239s infinite;
}
.g-ball:nth-child(34) {
width: 44px;
height: 44px;
radius: 50% 50%;
left: calc(31px - 55px);
}
.g-ball:nth-child(34) {
animation: movetop 1s linear -0.193s infinite;
}
.g-ball:nth-child(35) {
width: 5px;
height: 5px;
radius: 50% 50%;
left: calc(48px - 55px);
}
.g-ball:nth-child(35) {
animation: movetop 1s linear -1.575s infinite;
}
.g-ball:nth-child(36) {
width: 43px;
height: 43px;
radius: 50% 50%;
left: calc(53px - 55px);
}
.g-ball:nth-child(36) {
animation: movetop 1s linear -2.663s infinite;
}
.g-ball:nth-child(37) {
width: 18px;
height: .........完整代码请登录后点击上方下载按钮下载查看
















网友评论0