css实现百叶窗拖动往下拉打开效果代码
代码语言:html
所属分类:拖放
代码描述:css实现百叶窗拖动往下拉打开效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
@layer demo-stuff, container-stuff;
@layer container-stuff {
*, *:after, *:before {
pointer-events: none;
}
.container {
pointer-events: all;
container-type: size;
}
@container (min-height: 75px) {
.blinds {
--open: 0;
}
}
@container (min-height: 100px) {
.peter {
--peter: 0;
}
}
@container (min-height: 80.5px) {
.blinds {
--open: 0.1;
}
}
@container (min-height: 103px) {
.peter {
--peter: 0.1;
}
}
@container (min-height: 86px) {
.blinds {
--open: 0.2;
}
}
@container (min-height: 106px) {
.peter {
--peter: 0.2;
}
}
@container (min-height: 91.5px) {
.blinds {
--open: 0.3;
}
}
@container (min-height: 109px) {
.peter {
--peter: 0.3;
}
}
@container (min-height: 97px) {
.blinds {
--open: 0.4;
}
}
@container (min-height: 112px) {
.peter {
--peter: 0.4;
}
}
@container (min-height: 102.5px) {
.blinds {
--open: 0.5;
}
}
@container (min-height: 115px) {
.peter {
--peter: 0.5;
}
}
@container (min-height: 108px) {
.blinds {
--open: 0.6;
}
}
@container (min-height: 118px) {
.peter {
--peter: 0.6;
}
}
@container (min-height: 113.5px) {
.blinds {
--open: 0.7;
}
}
@container (min-height: 121px) {
.peter {
--peter: 0.7;
}
}
@container (min-height: 119px) {
.blinds {
--open: 0.8;
}
}
@container (min-height: 124px) {
.peter {
--peter: 0.8;
}
}
@container (min-height: 124.5px) {
.blinds {
--open: 0.9;
}
}
@container (min-height: 127px) {
.peter {
--peter: 0.9;
}
}
@container (min-height: 130px) {
.blinds {
--open: 1;
}
}
@container (min-height: 130px) {
.peter {
--peter: 1;
}
}
}
@layer demo-stuff {
* {
box-sizing: border-box;
transform-style: preserve-3d;
}
:root {
--height: 300px;
--width: calc(0.6 * var(--height));
--glass: rgba(207, 229, 252, 0.5);
--shimmer: rgba(255, 255, 255, 0.95);
--w-1: #546043;
--w-2: #373c2f;
--f-1: #251b0e;
--f-2: #372915;
--f-3: #5c4424;
--f-4: #6e522b;
--i-1: #574638;
--b-1: #b5bea7;
--b-4: #bfc7b3;
--b-2: #6a7557;
--b-3: #353b2b;
}
h1 {
font-size: 100px;
text-align: center;
margin: 40px 0 0 0;
color: hsl(0 0% 100%);
letter-spacing: -1px;
position: fixed;
top: 50%;
left: 50%;
transform: translate3d(100%, 0%, 110vmin);
}
body {
min-height: 100vh;
display: grid;
place-items: center;
justify-content: center;
overflow: hidden;
background: rgba(255, 230, 153, 0.5);
font-family: 'Impact', sans-serif;
}
.cuboid {
width: 100%;
height: 100%;
position: relative;
pointer-events: none;
}
.cuboid__side {
pointer-events: none;
}
.cuboid__side:nth-of-type(1) {
height: calc(var(--thickness) * 1px);
width: 100%;
position: absolute;
top: 0;
transform: translate(0, -50%) rotateX(90deg);
}
.cuboid__side:nth-of-type(2) {
height: 100%;
width: calc(var(--thickness) * 1px);
position: absolute;
top: 50%;
right: 0;
transform: translate(50%, -50%) rotateY(90deg);
}
.cuboid__side:nth-of-type(3) {
width: 100%;
height: calc(var(--thickness) * 1px);
position: absolute;
bottom: 0;
transform: translate(0%, 50%) rotateX(90deg);
}
.cuboid__side:nth-of-type(4) {
height: 100%;
width: calc(var(--thickness) * 1px);
position: absolute;
left: 0;
top: 50%;
transform: translate(-50%, -50%) rotateY(90deg);
}
.cuboid__side:nth-of-type(5) {
height: 100%;
width: 100%;
transform: translate3d(0, 0, calc(var(--thickness) * 0.5px));
position: absolute;
top: 0;
left: 0;
}
.cuboid__side:nth-of-type(6) {
height: 100%;
width: 100%;
transform: translate3d(0, 0, calc(var(--thickness) * -0.5px))
rotateY(180deg);
position: absolute;
top: 0;
left: 0;
}
.scene {
transform: translateZ(100vmin) rotateX(-24deg) rotateY(24deg);
}
.window {
height: var(--height);
width: var(--width);
position: relative;
}
.glass {
height: calc(var(--height) * 0.25);
width: 25%;
position: absolute;
top: 0;
right: 0;
background: linear-gradient(var(--i-1), var(--i-1)) 0 0/100% 5% no-repeat,
linear-gradient(var(--i-1), var(--i-1)) 0 0/5% 100% no-repeat,
linear-gradient(var(--i-1), var(--i-1)) 100% 0/5% 100% no-repeat,
linear-gradient(var(--i-1), var(--i-1)) 0 100%/100% 5% no-repeat,
linear-gradient(var(--i-1), var(--i-1)) 0 64%/100% 8% no-repeat,
linear-gradient(
130deg,
transparent 0 15%,
var(--shimmer) 16% 35%,
transparent 36% 40%,
var(--shimmer) 41% 44%,
transparent 45%
),
var(--glass);
}
.frame {
position: absolute;
}
.frame--top {
width: 130%;
height: 5%;
bottom: 100%;
left: 50%;
transform: translate(-50%, 0);
}
.frame--sill {
width: 120%;
height: 5%;
top: 1.........完整代码请登录后点击上方下载按钮下载查看
网友评论0