WebGL可调参数扭曲特效(黑洞 漩涡 鱼眼 玻璃球 )四种效果代码
代码语言:html
所属分类:动画
代码描述:WebGL可调参数扭曲特效(黑洞 漩涡 鱼眼 玻璃球 )四种效果代码
代码标签: WebGL 调 参数 扭曲 特效 黑洞 漩涡 鱼眼 玻璃球 四种 效果 代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> body { margin: 0; color: #fff; background-color: #000; font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; font-size: 30px; font-weight: bold; text-align: center; overflow: hidden; } input { display: none; } canvas { height: 100vh; width: auto; } #CTA { margin: .5em; position: absolute; pointer-events: none; top: 0; display: none; color: #fff; font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; font-weight: bold; font-size: 30px; text-shadow: -5px -5px 5px #000; animation: fade 1s ease-in-out forwards 4s; } @keyframes fade { 0% { opacity: 1; } 100% { opacity: 0; } } #overlay { position: absolute; inset: 0%; display: flex; flex-direction: row; justify-content:space-around; pointer-events: none; transition: inset .5s ease-in-out; & > * { position: relative; } } #ghostCanvas { height: 100vmin; aspect-ratio: 1; } #circle, #distort { pointer-events: none; display: flex; width: -webkit-fill-available; width: -moz-available; } #circle { justify-content: space-evenly; & > * { place-items: center; } } #distort { flex-direction: column; justify-content: space-around; align-items: center; & label { pointer-events: all; } } .paramG { pointer-events: all; position: relative; height: 100vh; width: 50%; display: grid; grid-template-rows: 10vh 80vh 10vh; grid-template-columns: unset; transition: filter .5s ease-in-out; } .paramG.inactive { filter: saturate(0) brightness(.5); pointer-events: none; } .bar { position: relative; display: grid; justify-items: center; width: 66%; height: 80vh; --grad: transparent calc(50% - 2px), #fff 0 calc(50% + 2px), transparent 0; background: linear-gradient(90deg, var(--grad)); } .slider { width: 100%; height: 0; position: absolute; display: grid; place-items: center; pointer-events: none; &::before { content: ''; position: absolute; width: 30px; background: #fff; aspect-ratio: 1; border-radius: 50%; z-index: 3; } } .loIcon, .hiIcon { justify-self: center; position: relative; height: 100%; aspect-ratio: 1; } #loScale { scale: 33%; background: #480; } #hiScale { scale: 66%; background: #480; } #strength > div:nth-child(odd) { border-radius: 50%; } #loStrength { scale: 33%; background: #08f; box-shadow: inset 0 0 10px 10px #048; } #hiStrength { scale: 66%; background: #fb0; box-shadow: 0 0 15px 15px #f40; } .btn { width: 15vmin; aspect-ratio: 1; border-radius: 50%; background-color: #000; transition-property: scale filter; transition: .5s ease-in-out; filter: saturate(1); } #autoBtn { position: relative; animation: spin 3s linear infinite paused; &:hover { animation-play-state: running; } & * { position: absolute; } } #arrows { inset: 0; display: grid; align-items: center; & div { position: absolute; left: 50%; width: 25%; aspect-ratio: 1; clip-path: polygon(0 0, 100% 50%, 0 100%); background-color: var(--clr); transform-origin: 0 50%; transform: rotate(calc(120deg*var(--nth) + 70deg)) translateY(-6.75vmin); &:nth-child(1) { --nth: 0; --clr: #f80; } &:nth-child(2) { --nth: 1; --clr: #4b0; } &:nth-child(3) { --nth: 2; --clr: #08f; } } } #ring { mask-image: repeating-conic-gradient(black 0 70deg, transparent 0 120deg); inset: 0; & div { inset: inherit; background-image: conic-gradient(#f40, #f80 70deg 120deg, #060 0, #4b0 190deg 240deg, #00f 0, #08f 310deg); mask-image: radial-gradient(transparent 55%, black 0 70%, transparent 0); } } @keyframes spin { 100% { rotate: 360deg; } } #blackBtn { box-shadow: 0 0 5px 5px #fff, 0 0 10px 10px #40f; } #vortexBtn { aspect-ratio: 3/2; .........完整代码请登录后点击上方下载按钮下载查看
网友评论0