抖动的下划线动画特效
代码语言:html
所属分类:菜单导航
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Wobbly underline</title> <style> html { font-family: "Inter", sans-serif; } body { display: flex; align-items: center; justify-content: center; height: 100vh; } .container { overflow: hidden; position: relative; padding-bottom: 40px; } .snake { position: absolute; transition: transform 500ms; width: 100%; transform: translateY(-50%); top: 86%; } .snake path { fill: none; stroke: black; stroke-dasharray: 29 100; stroke-width: 1.5px; } .pos1 .snake { transform: translateX(33.33%) translateY(-50%); } .pos2 .snake { transform: translateX(66.67%) translateY(-50%); } .left .snake path { stroke-dashoffset: 0; transform: translateX(0); transition: stroke-dasharray500ms, stroke-dashoffset 500ms, transform 500ms; } .right .snake path { stroke-dashoffset: -70px; transform: translateX(-60%); transition: stroke-dasharray500ms, stroke-dashoffset 500ms, transform 500ms; } .instant .snake path { transition: none; } .menu { display: flex; height: 100px; left: 9px; position: relative; } .item { align-items: center; cursor: pointer; display: flex; flex-direction: column; justify-content: center; width: 136px; } .icon { width: 50px; } </style> </head> <body translate="no"> <div class="container"> <svg class="snake" viewBox="0 0 100 100"> <path d="M 5,50.000015 H 35 C 35,50.000015 35.966338,49.750005 36.875001,49.750005 C 37.783664,49.750005 38.749998,50.000015 38.749998,50.000015 C 38.749998,50.000015 39.622117,50.500015 40.624999,50.500015 C 41.627882,50.500015 42.5,50.000015 42.5,50.000015 C 42.5,50.000015 43.476418,48.5 44.374997,48.5 C 45.273576,48.5 46.249998,50.000015 46.249998,50.000015 C 46.249998,50.000015 47.22755,53 48.124999,53 C 49.022448,53 50,50.000015 50,50.000015 C 50,50.000015 50.977541,47 51.875001,47 C 52.772461,47 53.749998,50.000015 53.749998,50.000015 C 53.749998,50.000015 54.726428,51.5 55.624999,51.5 C 56.52357,51.5 57.5,50.000015 57.5,50.000015 C 57.5,50.000015 58.486661,49.500025 59.375001,49.500025 C 60.263341,49.500025 61.249998,50.000015 61.249998,50.000015 C 61.249998,50.000015 62.232702,50.249995 63.124999,50.249995 C 64.017296,50.249995 65,50.000015 65,50.000015 H 95" /> </svg> <div class="menu"> <div class="item"> <svg class="icon" xmlns="http://www.w3.org/2000/svg" data-name="Layer 1" x="0" y="0" version="1.1" id="svg3337" width="100" height="100" viewBox="0 0 100 100"><defs id="defs3299"><style id="style3297"> .cls-2 { fill: none; stroke: #000; stroke-linecap: round; stroke-width: 4px; stroke-linejoin: round } </style> </defs><path id="polyline3303" fill="none" stroke="#000" stroke-width="3.12948" stroke-linecap="round" stroke-miterlimit="10" d="M91.777 1.58L74.612 18.755l6.634 6.634L98.42 8.223" /><path class="cls-2" id="line3305" fill="none" stroke="#000" stroke-width="3.129" stroke-linecap="round" stroke-linejoin="round" d="M55.248 44.752L19.846 80.154" /><path class="cls-2" id="line3307" fill="none" stroke="#000" stroke-width="3.129" stroke-linecap="round" stroke-linejoin="round" d="M53.59 43.093L14.315 74.622" /><path class="cls-2" id="line3309" fill="none" stroke="#000" stroke-width="3.129" stroke-linecap="round" stroke-linejoin="round" d="M51.931 41.434L9.887 69.091" /><path class="cls-2" id="line3311" fill="none" stroke="#000" stroke-width="3.129" stroke-linecap="round" stroke-linejoin="round" d="M49.717 39.22L6.014 63.004" /><path class="cls-2" id="line3313" fill="none" stroke="#000" stroke-width="3.129" stroke-linecap="round" stroke-linejoin="round" d="M47.503 37.006L3.244 56.925" /><path class="cls-2" id="line3315" fill="none" stroke="#000" stroke-width="3.129" stroke-linecap="round" stroke-linejoin="round" d="M45.289 34.792L1.586 50.838" /><path class="cls-2" id="line3317" fill="none" stroke="#000" stroke-width="3.129" stroke-linecap="round" stroke-linejoin="round" d="M56.907 46.41L25.378 85.685" /><path class="cls-2" id="line3319" fill="none" stroke="#000" stroke-width="3.129" stroke-linecap="round" stroke-linejoin="round" d="M58.566 48.069L30.909 90.113" /><path class="cls-2" id="line3321" fill="none" stroke="#000" stroke-width="3.129" stroke-linecap="round" stroke-linejoin="round" d="M60.78 50.283L36.996 93.986" /><path class="cls-2" id="line3323" fill="none" stroke="#000" stroke-width="3.129" stroke-linecap="round" stroke-linejoin="round" d="M62.994 52.497L43.075 96.756" /><path class="cls-2" id="line3325" fill="none" stroke="#000" stroke-width="3.129" stroke-linecap="round" stroke-linejoin="round" d="M65.208 54.711L49.162 98.414" /><path d="M26.363 37.124c1.135 5..........完整代码请登录后点击上方下载按钮下载查看
网友评论0