css实现三维发光三角柱体选择花纹切换效果代码
代码语言:html
所属分类:三维
代码描述:css实现三维发光三角柱体选择花纹切换效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> @import url("https://fonts.googleapis.com/css2?family=Josefin+Sans:wght@600&display=swap"); *, *::before, *::after { padding: 0; margin: 0 auto; box-sizing: border-box; } body { font-family: "Josefin Sans", sans-serif; background-color: #111; color: #fff; min-height: 100vh; display: grid; place-items: center; perspective: 800px; } body *:not(:empty) { transform-style: preserve-3d; } input { display: none; } input#earth:checked ~ .stone path.earth { stroke-dashoffset: 0; } input#earth:checked ~ .stone circle.earth { opacity: 1; } input#earth:checked ~ .stone { --color: #7CB342; } input#earth:checked ~ .buttons label[for=earth] { background-color: #fdc; color: #222; } input#water:checked ~ .stone path.water { stroke-dashoffset: 0; } input#water:checked ~ .stone circle.water { opacity: 1; } input#water:checked ~ .stone { --color: #0288D1; } input#water:checked ~ .buttons label[for=water] { background-color: #fdc; color: #222; } input#wind:checked ~ .stone path.wind { stroke-dashoffset: 0; } input#wind:checked ~ .stone circle.wind { opacity: 1; } input#wind:checked ~ .stone { --color: #FDD835; } input#wind:checked ~ .buttons label[for=wind] { background-color: #fdc; color: #222; } input#fire:checked ~ .stone path.fire { stroke-dashoffset: 0; } input#fire:checked ~ .stone { --color: #C62828; } input#fire:checked ~ .buttons label[for=fire] { background-color: #fdc; color: #222; } .buttons { display: flex; gap: 0.25em; transform: translateY(-10em) translateZ(15em); z-index: 2; } .buttons label { position: relative; padding: 0.5em 0.5em 0.25em; border: 1px solid #fdc; background-color: #0007; border-radius: 0.1em; transition: all 0.5s; } .stone { position: absolute; left: 50%; top: 7em; -webkit-animation: rotate 16s infinite linear; animation: rotate 16s infinite linear; } .stone * { position: absolute; } @-webkit-keyframes rotate { from { transform: rotateX(-20deg) rotateY(0deg); } to { transform: rotateX(-20deg) rotateY(360deg); } } @keyframes rotate { from { transform: rotateX(-20deg) rotateY(0deg); } to { transform: rotateX(-20deg) rotateY(360deg); } } .face { width: 10em; height: 30em; background-color: #fdc; background-image: url("https://assets.codep.........完整代码请登录后点击上方下载按钮下载查看
网友评论0