gsap+svg实现菜单点击切换炫酷动画效果代码
代码语言:html
所属分类:菜单导航
代码描述:gsap+svg实现菜单点击切换炫酷动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> @import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@1,500&display=swap"); html, body { height: 100%; } body { background-color: #3d3e4a; display: flex; justify-content: center; align-items: center; flex-direction: column; } .container { align-items: center; display: flex; flex-wrap: wrap; justify-content: center; } .radio-btn-group { margin: 10px; } input[type=radio] { opacity: 0; position: absolute; } input[type=radio]:checked + label::before { box-shadow: 0 0 25px 2px #0763f7; } input[type=radio]:checked + label span { color: #c40a35; } input[type=radio]:focus + label::before { box-shadow: 0 0 25px 2px #0763f7; } label { color: #fff; cursor: pointer; display: flex; font-weight: 500; font-style: italic; align-items: center; justify-content: center; font-family: "IBM Plex Mono", monospace; height: 50px; padding: 0 30px; position: relative; } label::before { background-color: #24252c; background-image: repeating-linear-gradient(0deg, #181a29, #181a29 1px, #202436 1px, #202436 2px); border-radius: 10px; content: ""; height: 100%; position: absolute; left: 0; top: 0; overflow: hidden; transform: skew(-15deg); transition: box-shadow 700ms; width: 100%; z-index: -1; } label span { transition: color 350ms; z-index: 1; } label svg { border-radius: 10px; overflow: hidden; position: absolute; transform: skew(-15deg); } label svg .blue rect { fill: #76b3fa; shape-rendering: crispEdges; mix-blend-mode: plus-lighter; } label svg .pink rect { fill: #ff6bd3; shape-rendering: crispEdges; } </style> </head> <body translate="no"> <div class="container"> <div class="radio-btn-group"> <input type="radio" name="stagger-radio-group" value="1" id="input-one" /> <label for="input-one"> <span>Option 1</span> <svg height="100%" width="100%" xmlns="http://www.w3.org/2000/svg"> <g class="pink"> <rect x="-100%" y="0" width="100%" height="5" /> <rect x="-100%" y="5" width="100%" height="5" /> <rect x="-100%" y="10" width="100%" height="5" /> <rect x="-100%" y="15" width="100%" height="5" /> <rect x="-100%" y="20" width="100%" height="5" /> <rect x="-100%" y="25" width="100%" height="5" /> <rect x="-100%" y="30" width="100%" height="5" /> <rect x="-100%" y="35" width="100%" height="5" /> <rect x="-100%" y="40" width="100%" height="5" /> <rect x="-100%" y="45" width="100%" height="5" /> </g> <g class="blue"> <rect x="-100%" y="0" width="100%" height="5" /> <rect x="-100%" y="5" width="100%" height="5" /> <rect x="-100%" y="10" width="100%" height="5" /> <rect x="-100%" y="15" width="100%" height="5" /> <rect x="-100%" y="20" width="100%" height="5" /> <rect x="-100%" y="25" width="100%" height="5" /> <rect x="-100%" y="30" width="100%" height="5" /> <rect x="-100%" y="35" width="100%" height="5" /> <rect x="-100%" y="40" width="100%" height="5" /> <rect x="-100%" y="45" width="100%" height="5" /> </g> </svg> </label> </div> <div class="radio-btn-group"> <input type="radio" name="stagger-radio-group" value="2" id="input-two" /> <label for="input-two"> <span>Option 2</span> <svg height="100%" width="100%" xmlns="http://www.w3.org/2000/svg"> <g class="pink"> <rect x="-100%" y="0" width="100%" height="5" /> <rect x="-100%" y="5" width="100%" height="5" /> <rect x="-100%" y="10" width="100%" height="5" /> <rect x="-100%" y="15" width="100%" height="5" /> <rect x="-100%" y="20" width="100%" height="5" /> <rect x="-100%" y="25" width="100%" height="5" /> <rect x="-100%" y="30" width="100%" height="5" /> <rect x="-100%" y="35" width="100%" h.........完整代码请登录后点击上方下载按钮下载查看
网友评论0