js+css实现可调节参数的渐变边框效果代码
代码语言:html
所属分类:布局界面
代码描述:js+css实现可调节参数的渐变边框效果代码,通过dat.gui实现参数可视化调节。
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> *, *:after, *:before { box-sizing: border-box; transform-style: preserve-3d; } :root { --bg: hsl(0 0% 0%); } body { display: grid; place-items: center; min-height: 100vh; background: hsl(0 0% 14%); } article { color: hsl(0 0% 92%); background: linear-gradient(var(--bg), var(--bg)) padding-box, var(--gradient) border-box; border: calc(var(--border-width, 2) * 1px) solid transparent; padding: 2rem; border-radius: calc(var(--border-radius, 8) * 1px); width: 26ch; aspect-ratio: 4 / 3; display: grid; place-items: center; text-align: center; font-size: 1.5rem; font-weight: 300; position: relative; transform: translate3d(0, 0, 0); } article:not(.faux) { z-index: 2; } p { margin: 0; } /* Explosion */ [data-exploded] section { transition: transform 1s; } .faux { position: absolute; z-index: -1; inset: 0; background: var(--gradient) border-box; } [data-exploded] section { transform: rotateX(60deg) rotate(25deg); } [data-imploding] article:not(.faux), [data-exploded] article:not(.faux) { background: var(--bg) padding-box; } [data-exploded] article:not(.faux) p { transform: translate3d(0, 0, 200px); } [data-exploded] .faux { transform: translate3d(0, 0, -200px); } [data-exploded] .faux, [data-exploded] article:not(.faux) p { transition: transform 1s 1.5s; } [data-exploded] label { opacity: 1; transition: 1s 1..........完整代码请登录后点击上方下载按钮下载查看
网友评论0