css 抽屉动画,纯CSS抽屉

这篇博客介绍了一种纯CSS实现的抽屉动画,通过CSS3的transform和transition属性,创建了一个3D立体的抽屉效果,包括前端开发者可以利用的详细CSS代码示例,展示了如何创建前、后、上、下、左、右六个面的抽屉以及开关动画。
摘要由CSDN通过智能技术生成

css

* {

box-sizing: border-box;

}

body {

align-items: center;

background-color: #f9bf3b;

display: flex;

justify-content: center;

min-height: 100vh;

}

:root {

--height: 300;

--width: 200;

--depth: 150;

--drawerSize: calc((var(--height) / 3) - 10);

--drawerHole: calc((var(--height) - ((10 * 4) + (10 + 30))) / 3);

}

.chest {

height: calc(var(--height) * 1px);

-webkit-transform: rotateX(-30deg) rotateY(40deg);

transform: rotateX(-30deg) rotateY(40deg);

-webkit-transform-style: preserve-3d;

transform-style: preserve-3d;

width: calc(var(--width) * 1px);

}

.chest__panel {

height: 100%;

position: absolute;

-webkit-transform-style: preserve-3d;

transform-style: preserve-3d;

width: 100%;

}

.chest__panel:after {

content: '';

display: block;

height: 100%;

width: 100%;

}

.chest__panel--front {

-webkit-transform: translate3d(0, 0, calc(var(--depth) / 2 * 1px));

transform: translate3d(0, 0, calc(var(--depth) / 2 * 1px));

}

.chest__panel--front:after {

background: #5b5b5b;

content: '';

height: 4px;

position: absolute;

top: -2px;

width: 100%;

}

.chest__panel--front-frame {

border: 10px solid #5b5b5b;

border-bottom-width: 30px;

border-top-width: 10px;

-webkit-transform: translate3d(0, 0, 0);

transform: translate3d(0, 0, 0);

}

.chest__panel--front-frame:before {

background: #5b5b5b;

content: '';

height: 20px;

left: 0;

position: absolute;

top: calc(var(--drawerHole) *

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值