div+Css实现立体厚的磨砂玻璃三维旋转效果代码
代码语言:html
所属分类:三维
代码描述:div+Css实现立体厚的磨砂玻璃三维旋转效果代码
代码标签: div Css 立体 厚 磨砂 玻璃 三维 旋转
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> @charset "UTF-8"; @property --blur { syntax: "<length>"; initial-value: 0; inherits: true; } @property --brightness { syntax: "<number>"; initial-value: 0; inherits: true; } @property --rotationY { syntax: "<angle>"; initial-value: 0deg; inherits: true; } :root { --shape: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); } body { width: 100vw; height: 100vh; display: grid; place-items: center; background: url("//repo.bfw.wiki/bfwrepo/image/672d673e3453c.png") no-repeat center center, var(--color-surface); background-size: cover; color: var(--color-primary); font-family: "Helvetica Neue", monospace; font-weight: bold; font-size: 20vmin; margin: 0; perspective: 32rem; } .container { position: relative; display: grid; place-items: center; transform-style: preserve-3d; -webkit-animation: rotate 6s linear infinite; animation: rotate 6s linear infinite; transform: rotate3d(0, 1, 0, var(--rotationY)); will-change: transform; --distance: 3vmin; } .left, .right { position: absolute; width: calc(var(--distance) * 4); height: 28vmin; background: rgba(255, 255, 255, 0.2); -webkit-backdrop-filter: blur(0.3rem); backdrop-filter: blur(0.3rem); } .right.top { transform: rotateY(90deg) rotateX(45deg) translateZ(14vmin); } .right.bottom { transform: rotateY(-90deg) rotateX(45deg) translateZ(-14vmin); } .left.bottom { transform: rotateY(90deg) rotateX(45deg) translateZ(-14vmin); } .left.top { transform: rotateY(90deg) rotateX(-45deg) translateZ(-14vmin); } .front, .back { position: absolute; transform-style: preserve-3d; width: 40vmin; aspect-ratio: 1; background: rgba(5, 5, 5, 0.1); -webkit-backdrop-filter: blur(var(--blur)) brightness(var(--brightness)) invert(1) saturate(0.9); backdrop-filter: blur(var(--blur)) brightness(var(--brightness)) invert(1) saturate(0.9); -webkit-clip-path: var(--shape); clip-path: var(--shape); transform: translateZ(calc(var(--distance) * 2)); box-shadow: inset 0 0 10rem rgba(255, 255, 5, 0.05); } .front:after { position: absolute; inset: 1rem; -webkit-clip-path: var(--shape); clip-path: var(--shape); background: rgba(255, 255, 255, 0.05); opacity: 0.8; display: grid; place-items: center; conten.........完整代码请登录后点击上方下载按钮下载查看
网友评论0