css实现三维分层盒子模型演示动画效果代码
代码语言:html
所属分类:动画
代码描述:css实现三维分层盒子模型演示动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
.stack {
display: grid;
grid: [stack] / [stack];
perspective: 5000
}
.stack:before {
content: "";
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: rgb(240, 240, 240);
transition: background 2s ease;
pointer-events: none;
}
.stack:hover:before, .stack:active:before {
background: rgb(37, 37, 37);
}
.stack:hover .card, .stack:active .card {
--bg-opacity: 5%;
transition-duration: 2s;
transition-timing-function: var(--easeInOutCirc);
transform:
rotateX(45deg) rotate(45deg)
translateZ(var(--z-offset)) translateY(20vh) translateX(20vh)
}
.stack:hover .card:nth-child(1), .stack:active .card:nth-child(1) { --z-offset: 75vh; }
.stack:hover .card:nth-child(2), .stack:active .card:nth-child(2) { --z-offset: 50vh; }
.stack:hover .card:nth-child(3), .stack:active .card:nth-child(3) { --z-offset: 25vh; }
.stack:hover .card:nth-child(4), .stack:active .card:nth-child(4) { --z-offset: 0vh; }
.stack:hover .card:nth-child(5), .stack:active .card:nth-child(5) { --z-offset: -25vh; }
.stack:hover .card:nth-child(1)::after, .stack:active .card:nth-child(1)::after { transition-delay: 1.5s; }
.stack:hover .card:nth-child(.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0