Éjection Confettis
Explosion festive de particules néon projetées tout autour du bouton.
Démo en direct
Survolez les boutons pour voir l'effet.
Comment utiliser cet effet
Collez le HTML dans votre page et le CSS dans votre feuille de style. Modifiez --btn-color, --btn-bg et --anim-speed selon votre design.
<button class="hover-btn btn-size-md btn-hover-confetti-burst">
<span>HoverLab</span>
<svg class="btn-icon btn-icon-right" width="18" height="18" viewBox="0 0 256 256" fill="currentColor"><path d="M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z"></path></svg>
</button>
/* ==========================================
HoverLab Effect #18: 18. Éjection Confettis
Self-Contained & Plug-and-Play CSS
========================================== */
:root {
--btn-color: #e6332a;
--btn-bg: #eeeeee;
--anim-speed: 0.35s;
}
/* Base Button Styles */
.hover-btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 10px;
padding: 12px 28px;
font-family: inherit;
font-size: 15px;
font-weight: 500;
letter-spacing: -0.01em;
white-space: nowrap;
cursor: pointer;
background-color: transparent;
color: var(--btn-color, #e6332a);
border: 1.5px solid var(--btn-color, #e6332a);
border-radius: 9999px;
text-decoration: none;
user-select: none;
transition: all var(--anim-speed, 0.35s) cubic-bezier(0.16, 1, 0.3, 1);
box-sizing: border-box;
}
.hover-btn.btn-icon-only {
padding: 0 !important;
aspect-ratio: 1 / 1;
width: 44px;
height: 44px;
}
.hover-btn .btn-icon {
display: block;
flex-shrink: 0;
transition: transform var(--anim-speed, 0.35s) cubic-bezier(0.16, 1, 0.3, 1);
}
/* Effect Styles */
.btn-hover-confetti-burst {
position: relative;
z-index: 1;
transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}
.btn-hover-confetti-burst:active {
transform: scale(0.96);
}
.btn-hover-confetti-burst::before,
.btn-hover-confetti-burst::after {
position: absolute;
content: "";
width: 170%;
left: 50%;
height: 110%;
transform: translateX(-50%);
z-index: -1;
background-repeat: no-repeat;
pointer-events: none;
opacity: 0;
}
.btn-hover-confetti-burst:hover::before {
opacity: 1;
top: -75%;
background-image:
radial-gradient(circle, #FF007F 22%, transparent 22%),
radial-gradient(circle, transparent 15%, #00FF66 22%, transparent 28%),
radial-gradient(circle, #B026FF 22%, transparent 22%),
radial-gradient(circle, #CCFF00 22%, transparent 22%),
radial-gradient(circle, transparent 10%, #00F0FF 18%, transparent 24%),
radial-gradient(circle, #FFE600 22%, transparent 22%),
radial-gradient(circle, #FF5500 22%, transparent 22%),
radial-gradient(circle, #FF007F 22%, transparent 22%),
radial-gradient(circle, #00F0FF 22%, transparent 22%);
background-size: 12% 12%, 22% 22%, 16% 16%, 22% 22%, 20% 20%, 12% 12%, 16% 16%, 12% 12%, 20% 20%;
background-position: 50% 120%;
animation: animate_top_confetti 0.65s cubic-bezier(0.16, 1, 0.3, 1) forwards 1;
}
@keyframes animate_top_confetti {
0% {
background-position: 5% 90%, 10% 90%, 10% 90%, 15% 90%, 25% 90%, 25% 90%, 40% 90%, 55% 90%, 70% 90%;
}
50% {
background-position: 0% 80%, 0% 20%, 10% 40%, 20% 0%, 30% 30%, 22% 50%, 50% 50%, 65% 20%, 90% 30%;
}
100% {
background-position: 0% 70%, 0% 10%, 10% 30%, 20% -10%, 30% 20%, 22% 40%, 50% 40%, 65% 10%, 90% 20%;
background-size: 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%;
}
}
.btn-hover-confetti-burst:hover::after {
opacity: 1;
bottom: -75%;
background-image:
radial-gradient(circle, #FFE600 22%, transparent 22%),
radial-gradient(circle, #00FF66 22%, transparent 22%),
radial-gradient(circle, transparent 10%, #00F0FF 18%, transparent 24%),
radial-gradient(circle, #FF007F 22%, transparent 22%),
radial-gradient(circle, #B026FF 22%, transparent 22%),
radial-gradient(circle, #CCFF00 22%, transparent 22%),
radial-gradient(circle, #FF5500 22%, transparent 22%);
background-size: 16% 16%, 22% 22%, 20% 20%, 22% 22%, 16% 16%, 22% 22%, 20% 20%;
background-position: 50% 0%;
animation: animate_bottom_confetti 0.65s cubic-bezier(0.16, 1, 0.3, 1) forwards 1;
}
@keyframes animate_bottom_confetti {
0% {
background-position: 10% -10%, 30% 10%, 55% -10%, 70% -10%, 85% -10%, 70% -10%, 70% 0%;
}
50% {
background-position: 0% 80%, 20% 80%, 45% 60%, 60% 100%, 75% 70%, 95% 60%, 105% 0%;
}
100% {
background-position: 0% 90%, 20% 90%, 45% 70%, 60% 110%, 75% 80%, 95% 70%, 110% 10%;
background-size: 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%;
}
}
.btn-hover-confetti-burst:hover {
transform: translateY(-2px);
background-color: #18181b0a;
}
Quand l'utiliser
Les effets spéciaux ajoutent lumière, particules ou texture. Ils attirent l'œil : gardez-les pour un seul point fort par écran, comme un bouton de lancement, un CTA de tarifs ou un lien de portfolio créatif.
Accessibilité
Utilisez un vrai élément <button> ou <a> pour que l'effet marche aussi au clavier : dupliquez les sélecteurs :hover avec :focus-visible. Pour les visiteurs qui préfèrent moins d'animations, placez transitions et animations dans @media (prefers-reduced-motion: no-preference).
Compatibilité navigateurs
L'effet repose sur du CSS standard (transitions, transformations, pseudo-éléments et variables CSS). Il fonctionne sur les versions actuelles de Chrome, Edge, Firefox et Safari, sans JavaScript ni dépendance.