<main id="app" class="dark">

     <button class="" data-effect="flicker">
        <span class="text">Hover me, and change the effect below!</span>
        <span class="shimmer"></span>
    </button>

    <section class="selection">
        <label><input type="radio" name="style" value="spin" /> spin</label>
        <label><input type="radio" name="style" value="wipe" /> wipe</label>
        <label><input type="radio" name="style" value="flicker" checked/> flicker</label>
        <label><input type="radio" name="style" value="wave" /> wave</label>
        <label><input type="radio" name="style" value="throb" /> throb</label>
        <label><input type="radio" name="style" value="pulse" /> pulse</label>
    </section>
    
    <p>Based on <a href="https://codepen.io/simeydotme/pen/GRzVKqr" target="_blank">this previous Pen</a></p>
    
</main>

<!-- 













    social icons
-->
<a class="social-icon codepen" href="https://codepen.io/simeydotme" title="view my codepens">
    Made by Simey
</a>

<a class="social-icon twitter" href="https://twitter.com/simeydotme">
    <svg viewBox="0 0 24 24">
        <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
        <path d="M22 4.01c-1 .49 -1.98 .689 -3 .99c-1.121 -1.265 -2.783 -1.335 -4.38 -.737s-2.643 2.06 -2.62 3.737v1c-3.245 .083 -6.135 -1.395 -8 -4c0 0 -4.182 7.433 4 11c-1.872 1.247 -3.739 2.088 -6 2c3.308 1.803 6.913 2.423 10.034 1.517c3.58 -1.04 6.522 -3.723 7.651 -7.742a13.84 13.84 0 0 0 .497 -3.753c-.002 -.249 1.51 -2.772 1.818 -4.013z"></path>
    </svg>
</a>
<a class="social-icon github" href="https://github.com/simeydotme">
    <svg viewBox="0 0 24 24">
        <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
        <path d="M9 19c-4.3 1.4 -4.3 -2.5 -6 -3m12 5v-3.5c0 -1 .1 -1.4 -.5 -2c2.8 -.3 5.5 -1.4 5.5 -6a4.6 4.6 0 0 0 -1.3 -3.2a4.2 4.2 0 0 0 -.1 -3.2s-1.1 -.3 -3.5 1.3a12.3 12.3 0 0 0 -6.2 0c-2.4 -1.6 -3.5 -1.3 -3.5 -1.3a4.2 4.2 0 0 0 -.1 3.2a4.6 4.6 0 0 0 -1.3 3.2c0 4.6 2.7 5.7 5.5 6c-.6 .6 -.6 1.2 -.5 2v3.5"></path>
    </svg>
</a>
:root {
    --shimmer-hue-1: 213deg;
    --shimmer-sat-1: 95%;
    --shimmer-lit-1: 91%;
    --shimmer-hue-2: 248deg;
    --shimmer-sat-2: 100%;
    --shimmer-lit-2: 86%;
    --shimmer-hue-3: 293deg;
    --shimmer-sat-3: 78%;
    --shimmer-lit-3: 89%;
    
    --glow-hue: 222deg;
    --shadow-hue: 180deg;
    --spring-easing: linear(
    0, 0.002, 0.01 0.9%, 0.038 1.8%, 0.156, 0.312 5.8%, 0.789 11.1%, 1.015 14.2%,
    1.096, 1.157, 1.199, 1.224 20.3%, 1.231, 1.231, 1.226, 1.214 24.6%,
    1.176 26.9%, 1.057 32.6%, 1.007 35.5%, 0.984, 0.968, 0.956, 0.949 42%,
    0.946 44.1%, 0.95 46.5%, 0.998 57.2%, 1.007, 1.011 63.3%, 1.012 68.3%,
    0.998 84%, 1
  );
    --spring-duration: 1.33s;
}
@property --mask {
    syntax: "<angle>";
    inherits: false;
    initial-value: 33deg;
}

@keyframes spin {
    0% {
        --mask: 0deg;
    }
    100% {
        --mask: 360deg;
    }
}

@keyframes wipe {
    0% {
        mask-position: 200% center;
    }
    100% {
        mask-position: 0% center;
    }
}

@keyframes pulse {
    0%, 90%, 100% {
        opacity: 0;
    }
    20% {
        opacity: 1;
    }
}

@keyframes pulse2 {
    0% {
        opacity: 0;
    }
    8% {
        opacity: 1;
    }
    14% {
        opacity: 0;
    }
    20% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

@keyframes flicker {
  0% { opacity:0.1; mask-image:none;}
  1% { opacity:1; }
  2% { opacity:0.5; }
  3% { opacity:0.1; }
  4% { opacity:0.7; }
  5% { opacity:1; }
  7% { opacity:0.7; 
    mask-image: linear-gradient(
        90deg, transparent 15%, black 45%, black 55%, transparent 85%
    ); }
  8% { opacity:0.1; }
  10% { opacity:0.4; }
  13% { opacity:1; }
  15% { opacity:0.1;  
    mask-image: linear-gradient(
        45deg, rgba(0,0,0,0.4) 25%, transparent 45%, black 65%, black 90%, transparent 100%
    );}
  17% { opacity:0.8;}
  19% { opacity:0.3; }
  21.5% { opacity:0; }
  23% { opacity:1; }
  39% { opacity:0.7; }
  45% { opacity:0.2; }
  49% { opacity:0.9; }
  52% { opacity:0.7;}
  53.5% { opacity:0.2;  
    mask-image: linear-gradient(
        90deg, black 15%, black 45%, rgba(0,0,0,0.4) 75%, transparent 85%
    );}
  57% { opacity:0.8; }
  63% { opacity:1; }
  75% { opacity:.85; }
  77% { opacity:1; }
  80% { opacity:.9; }
  82% { opacity:.95; }
  83% { opacity:.85; }
  86% { opacity:1; }
  89% { opacity:.85; }
  91% { opacity:1; }
  92% { opacity:.9; }
  100% { opacity:1; }
}

@keyframes shine {
    0% {
        opacity: 0;
    }
    15% {
        opacity: 1;
    }
    55% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}
@keyframes text {
    0% {
        background-position: 100% center;
    }    
    100% {
        background-position: -100% center;
    }    
}

.dark button {
    color: var(--bg);
    font-weight: 600;
    font-size: 1.2em;
    background-image: linear-gradient(
        315deg, 
        hsl(var(--shimmer-hue-1),var(--shimmer-sat-1),var(--shimmer-lit-1)) 0.00%, 
        hsl(var(--shimmer-hue-2),var(--shimmer-sat-2),var(--shimmer-lit-2)) 47%,
        hsl(var(--shimmer-hue-3),var(--shimmer-sat-3),var(--shimmer-lit-3)) 100.00% 
    );
    padding: .8em 1.4em;
    position: relative;
    isolation: isolate;
    box-shadow: 0 2px 3px 1px hsl(var(--glow-hue) 50% 20% / 50%);
    border: none;
    outline: none;
    border-radius: 0.66em;
    scale: 1;
    transition: all var(--spring-duration) var(--spring-easing);
    text-transform: unset;
}

.shimmer {
    position: absolute;
    inset: -40px;
    border-radius: inherit;
    mix-blend-mode: color-dodge;
    mix-blend-mode: plus-lighter;
    pointer-events: none;
}

.shimmer::before,
.shimmer::after {
    transition: all 0.5s ease;
    opacity: 0;
    content: "";
    border-radius: inherit;
    position: absolute;
    inset: 40px;
}
.shimmer::before {
    box-shadow: 0 0 3px 2px hsl(var(--shimmer-hue-1) 20% 95%),
        0 0 7px 4px hsl(var(--shimmer-hue-1) 20% 80%),
        0 0 13px 8px hsl(var(--shimmer-hue-2) 40% 60%),
        0 0 22px 6px hsl(var(--shimmer-hue-2) 20% 40%);
    z-index: -1;
}
.shimmer::after {
    box-shadow: inset 0 0 0 1px hsl(var(--shimmer-hue-2) 70% 95%),
        inset 0 0 3px 1px hsl(var(--shimmer-hue-2) 100% 80%),
        inset 0 0 9px 1px hsl(var(--shimmer-hue-2) 100% 70%);
    z-index: 2;
}

button[disabled] {
    background: rgb(76 76 92);
    background-image: none;
}
button:hover:not(:active):not([disabled]) {
    scale: 1.1;
    transition-duration: calc(var(--spring-duration)*0.5);
}
button:active:not([disabled]) {
    scale: 1.05;
    transition-duration: calc(var(--spring-duration)*0.5);
}
button:focus .shimmer,
button:active .shimmer {
    animation-play-state: paused!important;
    mask-image: none!important;
}
button:hover:not([disabled]),
button:hover:not([disabled]) .shimmer::before,
button:hover:not([disabled]) .shimmer::after {
    opacity: 1;
}


button .text {
    color: transparent;
    background-clip: text;
    background-color: var(--bg);
    background-image: linear-gradient(120deg, transparent, hsla(var(--shimmer-hue-1),100%,80%,0.66) 40%, hsla(var(--shimmer-hue-2),100%,90%,.9) 50%, transparent 52%);
    background-repeat: no-repeat;
    background-size: 300% 300%;
    background-position: center 200%;
}

button:not([disabled]):hover .text {
    animation: text .66s ease-in-out 1;
}

button:not([disabled]) .shimmer::before,
button:not([disabled]) .shimmer::after {
    opacity: 1;
}
button:not([disabled]) .shimmer {
    mask-image: conic-gradient(
        from var(--mask, 0deg),
        transparent 0%,
        transparent 10%,
        black 36%,
        black 45%,
        transparent 50%,
        transparent 60%,
        black 85%,
        black 95%,
        transparent 100%
    );
    mask-size: cover;
    animation: spin 3s linear infinite both -0.5s;
}
button:not([disabled])[data-effect=wipe] .shimmer {
    mask-image: linear-gradient(
        90deg, transparent 20%, black 88%, transparent 90%
    );
    mask-size: 200% 200%;
    mask-position: center;
    animation: wipe 1.5s linear infinite both -0.5s;
}
button:not([disabled])[data-effect=wave] .shimmer {
    mask-image: linear-gradient(
        90deg, transparent 15%, black 45%, black 55%, transparent 85%
    );
    mask-size: 200% 200%;
    mask-position: center;
    animation: wipe 3s linear infinite both -0.5s;
}
button:not([disabled])[data-effect=throb] .shimmer {
    mask-image: none;
    animation: pulse 3s ease infinite both  -0.5s;
}
button:not([disabled])[data-effect=pulse] .shimmer {
    mask-image: none;
    animation: pulse2 3s ease infinite both  -0.5s;
}
button:not([disabled])[data-effect=flicker] .shimmer {
    mask-image: none;
    animation: flicker 3.33s ease infinite both  -0.5s;
}











body,
html {
    display: block;
    height: 100dvh;
    padding: 20px;
    margin: 0;
    background-image: radial-gradient(
        circle at 50% 0%,
        rgb(67, 54, 74) 16.4%,
        rgb(47, 48, 67) 68.2%,
        rgb(27, 23, 36) 99.1%
    );
}
main#app {
    color: var(--fg);
    display: flex;
    flex-direction: column;
    margin: auto;
    padding: 16px;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    box-sizing: border-box;
}

.input {
    min-height: 100px;
    width: 100%;
    position: relative;
}
.count {
    position: absolute;
    right: 5px;
    bottom: 5px;
}
textarea {
    min-height: 100px;
    width: 100%;
    background: hsla(0deg,10%,10%,0.5);
    border: 1px solid hsla(0deg,10%,50%,0.5);
    border-radius: 8px;
    color: white;
    padding: 8px;
    box-sizing: border-box;
    font: inherit;
    resize: vertical;
}

.selection {
    margin: 20px auto;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
}
.selection label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

p {
    font-size: 1.2rem;
    margin-top: 4em;
    opacity: 0.5;
    &:hover {
        opacity: 1;
    }
}

let btn = document.querySelector("button");
let radios = document.querySelectorAll("[type=radio]");

radios[Math.floor(Math.random() * radios.length)].checked = true; 

radios.forEach((r) => {
    r.onchange = (e) => {
        btn.dataset.effect = e.currentTarget.value;
        btn.classList.remove('textShine');
        window.requestAnimationFrame(() => {
            btn.classList.add('textShine');
        });
    };
    if( r.checked ) {
        btn.dataset.effect = r.value;
    }
});

External CSS

  1. https://codepen.io/simeydotme/pen/JjVgPVg/cf6bd78bc35895cfde263b6098003c0b.css

External JavaScript

This Pen doesn't use any external JavaScript resources.