css+js实现可调整参数的下拉菜单选择立体展开效果代码
代码语言:html
所属分类:其他
代码描述:css+js实现可调整参数的下拉菜单选择立体展开效果代码,使用tweakpane来调节参数。
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <script type="module"> if (!("anchorName" in document.documentElement.style)) { window.UPDATE_ANCHOR_ON_ANIMATION_FRAME = true; import("//repo.bfw.wiki/bfwrepo/js/module/css-anchor-positioning.js"); } </script> <style> *, *:after, *:before { box-sizing: border-box; } body { display: grid; place-items: center; min-height: 100vh; font-family: 'SF Pro Text', 'SF Pro Icons', 'AOS Icons', 'Helvetica Neue', Helvetica, Arial, sans-serif, system-ui; } body::before { --size: 60px; --line: hsl(0 0% 0% / 0.15); content: ''; height: 100vh; width: 100vw; position: fixed; background: linear-gradient( 90deg, var(--line) 1px, transparent 1px var(--size) ) 50% 50% / var(--size) var(--size), linear-gradient(var(--line) 1px, transparent 1px var(--size)) 50% 50% / var(--size) var(--size); -webkit-mask: linear-gradient(-15deg, transparent 30%, white); mask: linear-gradient(-15deg, transparent 30%, white); top: 0; transform-style: flat; pointer-events: none; z-index: -1; } /* Anchor styles are managed inline inside the head */ #pop { inset: unset; /* display: block;*/ width: 180px; border: 0; padding: 0; background: transparent; transform-style: preserve-3d; overflow: visible; font-weight: 300; } body > [popovertarget] { anchor-name: --trigger; } #pop { left: anchor(--trigger left); top: calc(anchor(--trigger bottom) + 0.5rem); } :root { --speed: .5s; --accent: hsl(30 80% 50%); --ease: ease-out; accent-color: var(--accent); } @supports((-webkit-animation-timing-function: linear(1, 1)) or (animation-timing-function: linear(1, 1))) { :root { --ease: linear( 0, 0.0012 14.95%, 0.0089 22.36%, 0.0297 28.43%, 0.0668 33.43%, 0.0979 36.08%, 0.1363 38.55%, 0.2373 43.07%, 0.3675 47.01%, 0.5984 52.15%, 0.7121 55.23%, 0.8192 59.21%, 0.898 63.62%, 0.9297 66.23%, 0.9546 69.06%, 0.9733 72.17%, 0.9864 75.67%, 0.9982 83.73%, 1 ); } } #pop.\:popover-open .popover__content ul { -webkit-animation: drop calc(var(--speed) * 1s) var(--ease); animation: drop calc(var(--speed) * 1s) var(--ease); } #pop:popover-open .popover__content ul { -webkit-animation: drop calc(var(--speed) * 1s) var(--ease); animation: drop calc(va.........完整代码请登录后点击上方下载按钮下载查看
网友评论0