抖动的下划线动画特效

代码语言: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.7499.........完整代码请登录后点击上方下载按钮下载查看

网友评论0