Shine
The effect of a button that gains a slight shine over time.
Code
Just copy the following code to your project and this will work 😎
CSS
.shine-container {
padding: 1px;
background-color: var(--color-black-600);
.shine-button {
z-index: 2;
box-shadow: 0px 0px 2px var(--color-black);
}
&::before {
content: "";
position: absolute;
z-index: 1;
top: -20%;
left: -100%;
width: 60%;
height: 140%;
transform: skewX(-45deg);
animation: shine 5s linear infinite;
background-color: white;
filter: blur(6px);
}
}
@keyframes shine {
0% {
left: -100%;
}
100% {
left: 150%;
}
}
Example
<div class="flex relative overflow-hidden rounded-8px shine-container">
<button
name="button"
type="button"
class="flex gap-8px items-center justify-center whitespace-nowrap py-2px px-8px text-btn3 [&>svg]:w-[14px] [&>svg]:h-[14px] rounded-8px text-white dark:text-accent-900 border disabled:opacity-30 focus:shadow-[0_0_0_2px_#FFFFFF,0_0_0_4px_#0F172A] dark:focus:shadow-[0_0_0_2px_#2d2e33,0_0_0_4px_#FFFFFF] bg-accent-900 border-accent-900 hover:bg-accent-700 hover:border-accent-700 focus:bg-accent-700 focus:border-accent-700 active:bg-accent-500 active:border-accent-500 dark:bg-white dark:border-white dark:hover:bg-accent-200 dark:hover:border-accent-200 dark:focus:bg-accent-200 dark:focus:border-accent-200 dark:active:bg-accent-400 dark:active:border-accent-400 shine-button"
title="Get started">
Get started
</button>
</div>