clip-path 和 step 的运用 记录。

.punk-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 400px;
    height: 300px;
    margin: 100px auto;
    background-color: #F8F005;
}

.punk-btn, .punk-btn::after {
    position: relative;
    width: 150px;
    font-size: 25px;
    height: 40px;
    line-height: 40px;
    font-family: 'Bebas Neue', cursive;
    outline: none;
    border: none;
    cursor: pointer;
    letter-spacing: 3px;
    color: #fff;
    background: linear-gradient(45deg, transparent 5%, #FF013C 5%);
    box-shadow: 4px 0 0 #00E6F6;
}

.punk-btn::after {
    --slice-0: inset(50% 50% 50% 50%);
    --slice-1: inset(80% -6px 0 0);
    --slice-2: inset(50% -6px 30% 0);
    --slice-3: inset(10% -6px 85% 0);
    --slice-4: inset(40% -6px 43% 0);
    --slice-5: inset(80% -6px 5% 0);

    content: 'APPLY NOW';
    position: absolute;
    display: block;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 3%, #00E6F6 3%, #00E6F6 5%, #FF013C 5%);
    text-shadow: -3px -3px 0 #F8F005, 3px 3px 0 #00E6F6;
    clip-path: var(--slice-0);
}

.punk-btn:hover::after {
    animation: 1s glitch;
    animation-timing-function: steps(2, end);
}

@keyframes glitch {
    0% {
        clip-path: var(--slice-1);
        transform: translate(-20px, -10px);
    }
    10% {
        clip-path: var(--slice-3);
        transform: translate(10px, 10px);
    }
    20% {
        clip-path: var(--slice-1);
        transform: translate(-10px, 10px);
    }
    30% {
        clip-path: var(--slice-3);
        transform: translate(0px, 5px);
    }
    40% {
        clip-path: var(--slice-2);
        transform: translate(-5px, 0px);
    }
    50% {
        clip-path: var(--slice-3);
        transform: translate(5px, 0px);
    }
    60% {
        clip-path: var(--slice-4);
        transform: translate(5px, 10px);
    }
    70% {
        clip-path: var(--slice-2);
        transform: translate(-10px, 10px);
    }
    80% {
        clip-path: var(--slice-5);
        transform: translate(20px, -10px);
    }
    90% {
        clip-path: var(--slice-1);
        transform: translate(-10px, 0px);
    }
    100% {
        clip-path: var(--slice-1);
        transform: translate(0);
    }
}
<!-- 请放在 style 前 -->
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Bebas+Neue&display=swap" rel="stylesheet">


<div class="punk-wrap">
  <button class="punk-btn">APPLY NOW</button>
</div>

copy 至 CodingStartup起码课