css实现三维柱体依次上升无限循环动画效果代码
代码语言:html
所属分类:动画
代码描述:css实现三维柱体依次上升无限循环动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
* {
box-sizing: border-box;
transform-style: preserve-3d;
}
:root {
--perspective: 800;
--rotate-x: -15;
--rotate-y: -40;
--cuboid-width: 10;
--cuboid-height: 20;
--cuboid-depth: 10;
--scene: 20vmin;
--gap: 3vmin;
--duration: 8s;
--travel: -10vmin;
--hue: 280;
--s-1: hsl(var(--hue), 30%, 50%);
--s-2: hsl(var(--hue), 30%, 60%);
--s-3: hsl(var(--hue), 30%, 70%);
}
body {
min-height: 100vh;
background: #1a1a1a;
}
.scene {
perspective: calc(var(--perspective, 800) * 1px);
height: 100vh;
width: 100vw;
display: flex;
align-items: center;
justify-content: center;
}
.plane {
height: var(--scene);
width: var(--scene);
transform: rotateX(-32deg) rotateY(-34deg) rotateX(90deg) translate3d(0, 0, 0);
}
.towers {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(3, 1fr);
grid-gap: var(--gap);
height: var(--scene);
width: var(--scene);
-webkit-animation: lower var(--duration) infinite linear;
animation: lower var(--duration) infinite linear;
}
.cuboid {
--width: 100;
--height: var(--cuboid-height, 10);
--depth: 100;
height: 100%;
width: 100%;
position: relative;
transform: none;
}
.cuboid__side {
transition: transform 0.25s ease;
}
.cuboid > div:nth-of-type(1) {
height: calc(var(--height) * 1vmin);
width: calc(var(--width) * 1%);
position: absolute;
bottom: 0;
left: 50%;
transform-origin: 50% 100%;
transform: translate(-50%, 0) rotateX(-90deg);
background: linear-gradient(var(--s-1), transparent);
}
.cuboid > div:nth-of-type(2) {
height: calc(var(--height) * 1vmin);
width: calc(var(-.........完整代码请登录后点击上方下载按钮下载查看
网友评论0