css布局实现六边形网状球体类似足球旋转伸缩动画效果代码
代码语言:html
所属分类:动画
代码描述:采用css布局实现一个六边形网状球体,有点类似足球的形状自转并做伸缩运动的动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
*, *::before, *::after {
padding: 0;
margin: 0 auto;
box-sizing: border-box;
}
body {
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
perspective: 1125px;
background-image: radial-gradient(circle, #000, #222);
}
.ball {
position: relative;
transform-style: preserve-3d;
-webkit-animation: ball 60s infinite linear;
animation: ball 60s infinite linear;
--rx: 0deg;
--ry: 0deg;
}
@-webkit-keyframes ball {
from {
transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
}
to {
transform: rotateX(360deg) rotateY(720deg) rotateZ(360deg);
}
}
@keyframes ball {
from {
transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
}
to {
transform: rotateX(360deg) rotateY(720deg) rotateZ(360deg);
}
}
.ball > :nth-child(1) {
-webkit-animation-delay: -2.475s;
animation-delay: -2.475s;
-webkit-animation-duration: 4.7s;
animation-duration: 4.7s;
}
.ball > :nth-child(1)::before {
background-color: #8547ff;
}
.ball > :nth-child(2) {
-webkit-animation-delay: -4.05s;
animation-delay: -4.05s;
-webkit-animation-duration: 4.3s;
animation-duration: 4.3s;
}
.ball > :nth-child(2)::before {
background-color: #9966ff;
}
.ball > :nth-child(3) {
-webkit-animation-delay: -4.55s;
animation-delay: -4.55s;
-webkit-animation-duration: 5.1s;
animation-duration: 5.1s;
}
.ball > :nth-child(3)::before {
background-color: #aa80ff;
}
.ball > :nth-child(4) {
-webkit-animation-delay: -2.0625s;
animation-delay: -2.0625s;
-webkit-animation-duration: 4.15s;
animation-duration: 4.15s;
}
.ball > :nth-child(4)::before {
background-color: #9661ff;
}
.ball > :nth-child(5) {
-webkit-animation-delay: -1.725s;
animation-delay: -1.725s;
-webkit-animation-duration: 5.2s;
animation-duration: 5.2s;
}
.ball > :nth-child(5)::before {
background-color: #c2a3ff;
}
.ball > :nth-child(6) {
-webkit-animation-delay: -2.4125s;
animation-delay: -2.4125s;
-webkit-animation-duration: 4.65s;
animation-duration: 4.65s;
}
.ball > :nth-child(6)::before {
background-color: #8b52ff;
}
.ball > :nth-child(7) {
-webkit-animation-delay: -4.8s;
animation-delay: -4.8s;
-webkit-animation-duration: 6.2s;
animation-duration: 6.2s;
}
.ball > :nth-child(7)::before {
background-color: #d6c2ff;
}
.ball > :nth-child(8) {
-webkit-animation-delay: -0.9875s;
animation-delay: -0.9875s;
-webkit-animation-duration: 5.3s;
animation-duration: 5.3s;
}
.ball > :nth-child(8)::before {
background-color: #cfb8ff;
}
.ball > :nth-child(9) {
-webkit-animation-delay: -4.6125s;
animation-delay: -4.6125s;
-webkit-animation-duration: 4.25s;
animation-duration: 4.25s;
}
.ball > :nth-child(9)::before {
background-color: #d3bdff;
}
.ball > :nth-child(10) {
-webkit-animation-delay: -4.0375s;
animation-delay: -4.0375s;
-webkit-animation-duration: 4.05s;
animation-duration: 4.05s;
}
.ball > :nth-child(10)::before {
background-color: #9c6bff;
}
.ball > :nth-child(11) {
-webkit-animation-delay: -4.2s;
animation-delay: -4.2s;
-webkit-animation-duration: 5.95s;
animation-duration: 5.95s;
}
.ball > :nth-child(11)::before {
background-color: #8f57ff;
}
.ball > :nth-child(12) {
-webkit-animation-delay: -1.35s;
animation-delay: -1.35s;
-webkit-animation-duration: 4.35s;
animation-duration: 4.35s;
}
.ball > :nth-child(12)::before {
background-color: #ccb3ff;
}
.ball > :nth-child(13) {
-webk.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0