纯css圆柱体伸缩动画效果
代码语言:html
所属分类:动画
代码描述:纯css圆柱体伸缩动画效果
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
body {
background: #000;
height: 100vh;
overflow: hidden;
display: -webkit-box;
display: flex;
-webkit-box-pack: center;
justify-content: center;
-webkit-box-align: center;
align-items: center;
}
.pistons {
display: grid;
grid-template-rows: repeat(5, 80px);
grid-template-columns: repeat(5, 80px);
-webkit-transform: translateY(-50px);
transform: translateY(-50px);
}
.piston {
position: relative;
border: 6px solid #000;
width: 50px;
height: 200px;
margin: 0 20px;
background: -webkit-gradient(linear, left top, right top, from(#cff), color-stop(82%, #368), to(#699));
background: linear-gradient(90deg, #cff, #368 82%, #699);
border-radius: 999px;
-webkit-transform: scaleY(0.5);
transform: scaleY(0.5);
box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
}
.piston::before {
content: '';
position: absolute;
top: 3px;
left: 3px;
width: 44px;
height: 44px;
background: -webkit-gradient(linear, left top, right top, color-stop(50%, #cff), to(#8dd));
background: linear-gradient(90deg, #cff 50%, #8dd);
border-radius: 100%;
}
.piston:nth-child(1) {
-webkit-animation: piston 2s ease-in-out infinite alternate;
animation: piston 2s ease-in-out infinite alternate;
-webkit-animation-delay: -885ms;
animation-delay: -885ms;
-webkit-animation-duration: 2171ms;
animation-duration: 2171ms;
}
.piston:nth-child(2) {
-webkit-animation: piston 2s ease-in-out infinite alternate;
animation: piston 2s ease-in-out infinite alternate;
-webkit-animation-delay: -352ms;
.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0