css实现div花朵动画效果代码
代码语言:html
所属分类:动画
代码描述:css实现div花朵动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
@keyframes float {
to {
transform: translateY(0.75em);
}
}
@property --p {
syntax: "<length-percentage>";
initial-value: -1px;
inherits: false;
}
body {
--tmp: repeat(var(--n), calc(80vmin/var(--n)));
display: grid;
grid-gap: 2px;
grid-template: var(--tmp)/var(--tmp);
place-content: center;
margin: 0;
height: 100vh;
background: #4c5a63;
}
.cell {
--m: calc(.5*(var(--n) - 1));
--dif-i: calc(var(--m) - var(--i));
--abs-i: max(var(--dif-i), -1*var(--dif-i));
--sgn-i: clamp(-1, var(--dif-i)/.5, 1);
--dif-j: calc(var(--m) - var(--j));
--abs-j: max(var(--dif-j), -1*var(--dif-j));
--sgn-j: clamp(-1, var(--dif-j)/.5, 1);
background: radial-gradient(circle at calc(50% + 50%*var(--sgn-i)) calc(50% + 50%*var(--sgn-j)), currentcolor var(--p), transparent calc(var(--p) + 1px)) #e69951;
color: #855143;
animation: c0 4s steps(1) infinite, c1 4s steps(1) infinite, p 2s linear infinite;
animation-delay: calc((.5*(var(--abs-i) + var(--abs-j))/var(--m) - 1)*2s);
}
@keyframes p {
0% {
--p: 100% ;
}
}
@keyframes c0 {
50% {
color: #e69951;
}
}
@keyframes c1 {
50% {
background-color: #855143;
}
}
</style>
</head>
<body style="--n: 15">
<style>.cell:nth-of-type(15n + 1) { --i: 0 }
.cell:nth-of-type(n + 1) { --j: 0 }.cell:nth-of-type(15n + 2) { --i: 1 }
.cell:nth-of-type(n + 16) { --j: 1 }.cell:nth-of-type(15n + 3) { --i: 2 }
.cell:nth-of-type(n + 31) { --j: 2 }.cell:nth-of-type(15n + 4) { --i: 3 }
.cell:nth-of-type(n + 46) { --j: 3 }.cell:nth-of-type(15n + 5) { --i: 4 }
.cell:nth-of-type(n + 61) { --j: 4 }.cell:nth-of-type(15n + 6) { --i: 5 }
.cell:nth-of-type(n + 76) { --j: 5 }.cell:nth-of-type(15n + 7) { --i: 6 }
.cell:nth-of-type(n + 91) { --j: 6 }.cell:nth-of-type(15n + 8) { --i: 7 }
.cell:nth-of-type(n + 106) { --j: 7 }.cell:nth-of-type(15n + 9) { --i: 8 }
.cell:nth-of-type(n + 121) { --j: 8 }.cell:nth-of-type(15n + 10) { --i: 9 }
.cell:nth-of-type(n + 136) { --j: 9 }.cell:nth-of-type(15n + 11) { --i: 10 }
.cell:nth-of-.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0