三维盒子弹出卡片特效动画
代码语言:html
所属分类:三维
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> html { box-sizing: border-box; } *, *:before, *:after { box-sizing: inherit; } body { background: radial-gradient(#ffffff 50%, #d5d3d5 100%); overflow: hidden; } body, html { height: 100%; width: 100%; margin: 0; padding: 0; } .scene { position: relative; display: flex; align-items: center; justify-content: center; height: 100%; -webkit-perspective: 900px; perspective: 900px; visibility: hidden; } .box { -webkit-transform-style: preserve-3d; transform-style: preserve-3d; position: relative; z-index: 2; width: 180px; height: 249.66px; transform-style: preserve-3d; } .box__front, .box__back { position: absolute; width: 100%; height: 100%; } .box__left, .box__right { position: absolute; top: 0; left: calc(50% - 49.239px/2); height: 100%; width: 49.239px; background: #ececec; } .box__flap { position: absolute; left: calc(50% - 49.239px/2); top: calc(50% - 49.239px/2); width: 49.239px; height: 0; -webkit-transform-origin: 50% 100%; transform-origin: 50% 100%; border-bottom: 49.239px solid #dedede; border-left: calc(49.239px/10) solid transparent; border-right: calc(49.239px/10) solid transparent; } .box__lid { position: absolute; z-index: 0; top: calc(50% - 49.239px/2); width: 180px; height: 49.239px; -webkit-transform-origin: 50% 100%; transform-origin: 50% 100%; -webkit-transform-style: preserve-3d; transform-style: preserve-3d; -webkit-transform: translateZ(calc(-49.239px/2)) translateY(calc(-249.66px/2 - 49.239px/2 + 0.5px)) rotateY(180deg) rotateX(90deg); transform: translateZ(calc(-49.239px/2)) translateY(calc(-249.66px/2 - 49.239px/2 + 0.5px)) rotateY(180deg) rotateX(90deg); } .box__lid-inner { position: relative; height: 100%; z-index: 0; -webkit-transform-style: preserve-3d; transform-style: preserve-3d; } .box__lid-top { width: 180px; height: 49.239px; -webkit-transform-style: preserve-3d; transform-style: preserve-3d; } .box__lid-top-logo { position: absolute; z-index: 0; top: 0; left: 0; width: 180px; height: 49.239px; background: #d9d9d9; background-blend-mode: multiply; background-size: cover; -webkit-transform: rotateX(0deg); transform: rotateX(0deg); -webkit-backface-visibility: hidden; backface-visibility: hidden; } .box__lid-top-back { position: absolute; left: 0; top: 0; width: 180px; height: 49.239px; background: #ececec; background-image: linear-gradient(-145deg, rgba(0, 0, 0, 0.2) 0%, rgba(236, 236, 236, 0.5) 72%, rgba(255, 255, 255, 0.3) 73%); -webkit-transform: rotateX(180deg); transform: rotateX(180deg); -webkit-backface-visibility: hidden; backface-visibility: hidden; } .box__lid-flap { position: absolute; z-index: 0; top: calc(50% - 49.239px/2); overflow: hidden; width: 100%; height: 100%; -webkit-transform-origin: 50% 100%; transform-origin: 50% 100%; -webkit-transform-style: preserve-3d; transform-style: preserve-3d; -webkit-transform: translateY(calc(-49.239px + 1px)) rotateX(120deg); transform: translateY(calc(-49.239px + 1px)) rotateX(120deg); } .box__lid-flap-shape { position: absolute; width: 100%; height: 190%; border-radius: 50% / 90%; overflow: hidden; background: #ececec; } .box__lid-flap-shape-inner { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: #ececec; background: linear-gradient(0deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0) 65%); } .box__lid-flap-shape-outer { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: #ececec; -webkit-transform: rotateX(180deg); transform: rotateX(180deg); } .box__flap--left { -webkit-transform: translateX(calc(-180px/2)) translateY(calc(-249.66px/2 - 49.239px/2 )) translateZ(0px) rotateY(270deg) rotateX(90deg); transform: translateX(calc(-180px/2)) translateY(calc(-249.66px/2 - 49.239px/2 )) translateZ(0px) rotateY(270deg) rotateX(90deg); } .box__flap--right { -webkit-transform: translateX(calc(180px/2)) translateY(calc(-249.66px/2 - 49.239px/2 )) translateZ(0px) rotateY(90deg) rotateX(90deg); transform: translateX(calc(180px/2)) translateY(calc(-249.66px/2 - 49.239px/2 )) translateZ(0px) rotateY(90deg) rotateX(90deg); } .box__front { -webkit-transform-style: preserve-3d; transform-style: preserve-3d; -webkit-transform: translateZ(calc(-49.239px/2)); transform: translateZ(calc(-49.239px/2)); -webkit-backface-visibility: hidden; backface-visibility: hidden; } .box__front:before { position: absolute; left: 0; top: 0; content: ''; width: 100%; height: 100%; background: #cccbcd; } .box__front-face { position: absolute; left: 0; top: 0; width: 100%; height: 100%; background: #ececec; background-size: cover; -webkit-transform: rotateY(180deg); transform: rotateY(180deg); -webkit-transform-style: preserve-3d; transform-style: preserve-3d; -webkit-backface-visibility: hidden; backface-visibility: hidden; } .box__back { z-index: 10; background: transparent; -webkit-transform: translateZ(calc(49.239px/2)) rotateY(0deg); transform: translateZ(calc(49.239px/2)) rotateY(0deg); background: #ececec; background-size: cover; } .box__left { background:#dededep; background-size: cover; -webkit-transform: translateX(calc(-180px/2)) rotateY(-90deg); transform: translateX(calc(-180px/2)) rotateY(-90deg); } .box__right { background: #dedede; background-size: cover; -webkit-transform: translateX(calc(180px/2)) rotateY(90deg); transform: translateX(calc(180px/2)) rotateY(90deg); } .box__bottom { position: absolute; left: 0; top: calc(50% - 49.239px/2); width: 100%; height: 49.239px; background: #ececec; -webkit-transform: translateY(calc(249.66px/2)) rotateX(-90deg); transform: translateY(calc(249.66px/2)) rotateX(-90deg); } .card { position: absolute; left: calc((180px - 162px)/2); top: 3%; width: 162px; height: 225.8928px; background: black; -webkit-backface-visibility: hidden; backface-visibility: hidden; -webkit-transform-style: preserve-3d; transform-style: preserve-3d; } .card:after { position: absolute; content: ''; width: 100%; height: 100%; background: url(http://repo.bfw.wiki/bfwrepo/icon/5dfaeea881ced.png) no-repeat left top; background-size: cover; -webkit-backface-visibility: hidden; backface-visibility: hidden; -webkit-transform: rotateY(180deg); transform: rotateY(180deg); -webkit-transform-style: preserve-3d; transform-style: preserve-3d; } .card--1 { background: url(http://repo.bfw.wiki/bfwrepo/icon/5dfaeea881ced.png) no-repeat left top; background-size: cover; -webkit-transform: translateZ(0px) rotateY(180deg); transform: translateZ(0px) rotateY(180deg); } .card--2 { background: url(http://repo.bfw.wiki/bfwrepo/icon/5dfaeeb7d4389.png) no-repeat left top; background-size: cover; -webkit-transform: translateZ(3.6px) rotateY(180deg); transform: translateZ(3.6px) rotateY(180deg); } .card--3 { background: url(http://repo.bfw.wiki/bfwrepo/icon/5dfaeea881ced.png) no-repeat left top; background-size: cover; -webkit-transform: translateZ(7.2px) rotateY(180deg); transform: translateZ(7.2px) rotateY(180deg); } .card--4 { background: url(http://repo.bfw.wiki/bfwrepo/icon/5dfaeeb7d4389.png) no-repeat left top; background-size: cover; -webkit-transform: translateZ(10.8px) rotateY(180deg); transform: translateZ(10.8px) rotateY(180deg); } .card--5 { background: url(http://repo.bfw.wiki/bfwrepo/icon/5dfaeea881ced.png) no-repeat left top; background-size: cover; -webkit-transform: translateZ(14.4px) rotateY(180deg); transform: translateZ(14.4px) rotateY(180deg); } .gsap-3-logo { width: 20vw; max-width: 150px; position: fixed; bottom: 15px; right: 15px; } /* ========================================================== Collection Linl ========================================================== */ .collection { position: fixed; z-ind.........完整代码请登录后点击上方下载按钮下载查看
网友评论0