js+css实现rgb模糊效果代码
代码语言:html
所属分类:其他
代码描述:js+css实现rgb模糊效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> @import url("https://fonts.googleapis.com/css2?family=Space+Mono:ital,wght@0,700;1,700&display=swap"); :root { cursor: pointer; font-family: "Space Mono", monospace; font-weight: 700; } html { height: 100vh; background: #fcfcf6; box-shadow: inset 0 0 0 1px #202124; } .dark { background: #202124; box-shadow: inset 0 0 0 1px #fff; } .world { position: fixed; width: 60vmin; aspect-ratio: 1; top: 50%; left: 50%; transform: translate(-50%, -50%); display: flex; flex-wrap: wrap; pointer-events: none; } .el { position: relative; flex: 0 0 calc(100% / var(--w)); height: calc(100% / var(--h)); width: calc(100% / var(--w)); background: linear-gradient(45deg, var(--c2), var(--c3)); z-index: var(--z); opacity: var(--o); background: transparent; mix-blend-mode: multiply; } .el::before, .el::after { content: ""; position: absolute; inset: -50%; background: linear-gradient(45deg, var(--c0), var(--c1)); mix-blend-mode: color; /* border-style: doubble; background-clip: padding-box, border-box; background-origin: border-box; border: 4px solid transparent; */ } .no-blend .el::before, .no-blend .el::after { mix-blend-mode: none; } .shapes--random .el::before, .shapes--random .el::after { border-top-left-radius: var(--r0); border-top-right-radius: var(--r1); border-bottom-right-radius: var(--r2); border-bottom-left-radius: var(--r3); } .shapes--letters .el::before, .shapes--letters .el::after { content: attr(data-letter); -webkit-background-clip: text; -webkit-text-fill-color: transparent; font-size: calc(60vw / var(--h)); border-radius: 0 !important; text-align: center; } .shapes--circles .el.is-circle::before { border-radius: 50%; } .el::after { filter: blur(5vmin); border-radius: 50%; } .no-blur .el::after { display: none; } .dark .el::after { opacity: 0.6; } .shapes--animated .el.animated::before { -webkit-animation: 20s an infinite; animation: 20s an infinite; -webkit-animation-delay: calc(var(--rnd) * -30s); animation-delay: calc(var(--rnd) * -30s); } @-webkit-keyframes an { 50% { transform: translateY(calc(var(--rnd2) * 300%)); } } @keyframes an { 50% { transform: translateY(calc(var(--rnd2) * 300%)); } } /* .el::after { inset: 0; transform: rotate(180deg) scale(calc(.5 + var(--rnd) * 1.5)); border-radius: 50%; background: linear-gradient(45deg, var(--c2), var(--c1)); mix-blend-mode: lighten; }*/ </style> </head> <body > <div class="world" data-app> </div> <script > const $app = document.querySelector('[data-app]'); function generateRandomLetter() { const al.........完整代码请登录后点击上方下载按钮下载查看
网友评论0