css实现一个衣柜打开关闭动画效果代码

代码语言:html

所属分类:动画

代码描述:css实现一个衣柜打开关闭动画效果代码

代码标签: 衣柜 打开 关闭 动画 效果

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>

  <meta charset="UTF-8">
  

  
  
<style>
*,
*:after,
*:before {
  box-sizing: border-box;
  transform-style: preserve-3d;
}
@property --spin {
  initial-value: 0deg;
  inherits: false;
  syntax: '<angle>';
}
:root {
  --bg: #bddbbd;
  --width: 30;
  --height: 54;
  --backboard: #d1c294;
  --depth: 20;
  --rx: -20;
  --ry: 38;
  --thickness: 1;
  --hue: 0;
  --saturation: 0%;
  --unit-one: hsl(var(--hue), var(--saturation), 60%);
  --unit-two: hsl(var(--hue), var(--saturation), 50%);
  --unit-three: hsl(var(--hue), var(--saturation), 40%);
  --unit-four: hsl(var(--hue), var(--saturation), 30%);
  --shelf-one: #e6e6e6;
  --shelf-two: #d9d9d9;
  --shelf-three: #ccc;
  --rail-one: #e6e6e6;
  --rail-two: #ccc;
  --rail-three: #fff;
  --handle: #e6e6e6;
  --open: 0;
}
body {
  font-weight: bold;
  font-family: sans-serif;
}
.cuboid {
  width: 100%;
  height: 100%;
  position: relative;
}
.cuboid__side:nth-of-type(1) {
  height: calc(var(--thickness) * 1vmin);
  width: 100%;
  position: absolute;
  top: 0;
  transform: translate(0, -50%) rotateX(90deg);
}
.cuboid__side:nth-of-type(2) {
  height: 100%;
  width: calc(var(--thickness) * 1vmin);
  position: absolute;
  top: 50%;
  right: 0;
  transform: translate(50%, -50%) rotateY(90deg);
}
.cuboid__side:nth-of-type(3) {
  width: 100%;
  height: calc(var(--thickness) * 1vmin);
  position: absolute;
  bottom: 0;
  transform: translate(0%, 50%) rotateX(90deg);
}
.cuboid__side:nth-of-type(4) {
  height: 100%;
  width: calc(var(--thickness) * 1vmin);
  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.5vmin));
  position: absolute;
  top: 0;
  left: 0;
}
.cuboid__side:nth-of-type(6) {
  height: 100%;
  width: 100%;
  transform: translate3d(0, 0, calc(var(--thickness) * -0.5vmin)) rotateY(180deg);
  position: absolute;
  top: 0;
  left: 0;
}
body {
  background-color: var(--bg);
  min-height: 100vh;
  display: grid;
  place-items: center;
}
.wardrobe {
  -webkit-animation: spin 10s infinite linear;
          animation: spin 10s infinite linear;
  height: calc(var(--height) * 1vmin);
  width: calc(var(--width) * 1vmin);
  transform: translate3d(-50%, -50%, 50vmin) rotateX(calc(var(--rx) * 1deg)) rotateY(calc(var(--ry) * 1deg));
  position: absolute;
  top: 50%;
  left: 50%;
}
.wardrobe__panel {
  position: absolute;
}
.wardrobe__panel--top,
.wardrobe__panel--bottom {
  height: calc(var(--depth) * 1vmin);
  width: calc((var(--width) + 1) * 1vmin);
.........完整代码请登录后点击上方下载按钮下载查看

网友评论0