08반짝(キラッ)
`.o-kira`는 ::before·::after로 만든 작은 별 두 개를 서로 다른 delay로 scale·opacity 플래시시켜, '추천' 배지가 주기적으로 반짝이게 합니다.
쓰임추천 배지, 프리미엄 아이콘, 신규 기능 표시
scale+opacity::before/::after1.8s

<main class="stage">
<div class="badge o-kira">추천</div>
<span class="tag">반짝</span>
</main>@use "../../../../site/static/demo-tokens" as *;
// ── 변수 3개 ──────────────────────────────────────────
$duration: 1.8s;
$easing: ease-in-out;
$color: $subject-blue;
// ── 데모 무대 ───────────────────────────────
@include stage($stage-paper);
.stage { position: relative; }
.badge {
position: relative;
display: inline-flex;
align-items: center;
padding: $sp-3 $sp-6;
border-radius: $r-pill;
background: $stage-ink;
color: $subject-cream;
font-weight: 700;
font-size: clamp(15px, 4vw, 18px);
line-height: 1;
font-family: inherit;
box-shadow: $shadow-raised;
}
// ── 실제 두 개의 ::before·::after 별을 서로 다른 delay 로 반짝인다 ─────
.badge::before,
.badge::after {
content: "";
position: absolute;
width: 14px;
height: 14px;
border-radius: 50%;
background: $color;
opacity: 0;
}
.badge::before { top: -5px; left: 8px; }
.badge::after { bottom: -4px; right: 4px; }
.badge.o-kira::before { animation: o-kira $duration $easing infinite; }
.badge.o-kira::after { animation: o-kira $duration $easing infinite; animation-delay: .4s; }
@keyframes o-kira {
0%, 45%, 100% { opacity: 0; transform: scale(.4); }
62% { opacity: 1; transform: scale(1.3); }
78% { opacity: 0; transform: scale(.6); }
}
.tag {
position: absolute;
top: $sp-4;
right: $sp-4;
padding: $sp-1 $sp-3;
border-radius: $r-sm;
background: rgba(23, 20, 26, .08);
color: $stage-ink;
font-weight: 700;
font-size: 12px;
line-height: 1;
font-family: inherit;
letter-spacing: .04em;
}
// ── 접근성 ──────────────────────────────────────────
@media (prefers-reduced-motion: reduce) {
.badge.o-kira::before, .badge.o-kira::after { animation: none; }
}html, body {
margin: 0;
overflow: hidden;
}
.stage {
box-sizing: border-box;
min-height: 100vh;
display: grid;
place-items: center;
margin: 0;
background: #ffffff;
font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
padding: clamp(8px, 4vw, 24px);
}
.stage {
position: relative;
}
.badge {
position: relative;
display: inline-flex;
align-items: center;
padding: 12px 24px;
border-radius: 999px;
background: #17141a;
color: #fff7e6;
font-weight: 700;
font-size: clamp(15px, 4vw, 18px);
line-height: 1;
font-family: inherit;
box-shadow: 0 14px 24px rgba(23, 20, 26, 0.32);
}
.badge::before,
.badge::after {
content: "";
position: absolute;
width: 14px;
height: 14px;
border-radius: 50%;
background: #2f6df6;
opacity: 0;
}
.badge::before {
top: -5px;
left: 8px;
}
.badge::after {
bottom: -4px;
right: 4px;
}
.badge.o-kira::before {
animation: o-kira 1.8s ease-in-out infinite;
}
.badge.o-kira::after {
animation: o-kira 1.8s ease-in-out infinite;
animation-delay: 0.4s;
}
@keyframes o-kira {
0%, 45%, 100% {
opacity: 0;
transform: scale(0.4);
}
62% {
opacity: 1;
transform: scale(1.3);
}
78% {
opacity: 0;
transform: scale(0.6);
}
}
.tag {
position: absolute;
top: 16px;
right: 16px;
padding: 4px 12px;
border-radius: 8px;
background: rgba(23, 20, 26, 0.08);
color: #17141a;
font-weight: 700;
font-size: 12px;
line-height: 1;
font-family: inherit;
letter-spacing: 0.04em;
}
@media (prefers-reduced-motion: reduce) {
.badge.o-kira::before, .badge.o-kira::after {
animation: none;
}
}import type { CSSProperties, ReactNode } from "react";
import styles from "./SparkleBadge.module.scss";
export type SparkleBadgeProps = {
children: ReactNode;
/** 한 번 반짝이는 주기 (기본 1800ms) */
duration?: number;
easing?: string;
color?: string;
};
type Vars = CSSProperties & {
"--duration"?: string;
"--easing"?: string;
"--color"?: string;
};
export default function SparkleBadge({
children,
duration = 1800,
easing = "ease-in-out",
color = "#2f6df6",
}: SparkleBadgeProps) {
const vars: Vars = {
"--duration": `${duration}ms`,
"--easing": easing,
"--color": color,
};
return (
<div className={styles.badge} style={vars}>
{children}
</div>
);
}08 반짝(キラッ) — 측정 누적면적 0.399% · 움직인 프레임 12/23GODRICH 원작 · zip 에 SCSS·React 포함 · CSS 통통 튀는 애니메이션 9종 — 한 줄 복붙으로
이 데모가 속한 글
CSS 통통 튀는 애니메이션 9종 — 한 줄 복붙으로CSS 통통 튀는 애니메이션은 요소를 그냥 나타나게 하지 않고 뜨고, 튕기고, 떨고, 흔들리게 만들어 살아 있는 느낌을 주는 움직임입니다. 흔한 영어 이름 대신 둥실둥실·포용·푸루푸루 같은 의성어로 아홉 개를 골랐고 이 글의 데모 전부 보기


