css实现一个三维魔盒视觉差异效果代码
代码语言:html
所属分类:视觉差异
代码描述:css实现一个三维魔盒视觉差异效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> /* You can find more of this here https://codepen.io/cdmoro carlosbonadeo@gmail.com */ * { margin: 0; padding: 0; box-sizing: border-box; } body { display: flex; justify-content: center; align-items: center; height: 100vh; flex-direction: column; } .cube { width: 250px; height: 250px; display: flex; flex-direction: column; transform-style: preserve-3d; transform: rotatey(calc(var(--mouse-x) * 1deg - 50deg)) rotatex(calc((var(--mouse-y) * -1deg + 50deg))); } .middle { position: relative; width: 250px; height: 250px; transform-style: preserve-3d; } .face { height: 250px; width: 250px; background: url("//repo.bfw.wiki/bfwrepo/image/605694504fbd5.png"); transform-style: preserve-3d; } .face-center { background-position: center center; } .face-top { background-position: center top; transform: rotateX(-90deg) translateY(-100%); transform-origin: top; height: 250px; width: 250px; position: absolute; } .face-bottom { background-position: center bottom; transform: rotateX(90deg) translatey(100%); transform-origin: bottom; position: absolute; } .face-right { background-position: right center; transform: rotateY(-90deg) translatey(-100%) translatex(100%); transform-origin: right; posi.........完整代码请登录后点击上方下载按钮下载查看
网友评论0