纯css实现立方体伸缩动画效果

代码语言:html

所属分类:三维

代码描述:纯css实现立方体伸缩动画效果

代码标签: 立方体 伸缩 动画 效果

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


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

<style>
#byebyecube {
  width: 300px;
  height: 400px;
  position: relative;
  left: 50%;
  top: 0;
  margin-left: -150px;
  background-image: linear-gradient(30deg, #aaa 30%, rgba(170,170,170,0) 30.1%), linear-gradient(-30deg, #aaa 30%, rgba(170,170,170,0) 30.1%);
  -webkit-transform-style: preserve-3d;
          transform-style: preserve-3d;
}
#byebyecube:before,
#byebyecube:after {
  display: block;
  content: '';
  position: absolute;
}
#byebyecube:before {
  width: 200px;
  height: 280px;
  left: 50px;
  top: -8px;
  background-repeat: no-repeat;
  background-image: linear-gradient(30deg, transparent 26%, #ccc 26.3%, #ccc 74%, transparent 74.3%), linear-gradient(150deg, transparent 26%, #999 26.3%, #999 74%, transparent 74.3%), linear-gradient(150deg, transparent 26%, #eee 26.3%, #eee 73%, transparent 73%), linear-gradient(30deg, transparent 27%, #eee 27%, #eee 74%, transparent 74.3%), radial-gradient(circle at center, #eee 20%, transparent 20%);
  background-size: 50% 60%;
  background-position: 0 100%, 100% 100%, 0 48.5%, 100% 48.5%, 50% 60%;
  -webkit-animation: cube-drop 6000ms infinite alternate linear;
          animation: cube-drop 6000ms infinite alternate linear;
  z-index: -1;
}
#byebyecube:after {
  width: 113px;
  height: 100px;
  left: 92px;
  top: 164px;
  z-index: 0;
  -webkit-animation: cube-shadow 6000ms infinite alternate linear;
          animation: cube-shadow 6000ms infinite alternate linear;
}
html {
  height: 100vh;
  display: -webkit-box;
  display: flex;
  -webkit-box-align: center;
          align-items: center;
  -webkit-box-pack: center;
          justify-content: center;
  overflow: auto;
  background-color: #aaa;
}
body {.........完整代码请登录后点击上方下载按钮下载查看

网友评论0