04살랑살랑 흔들리는(ゆらゆら)
`.o-yura`는 transform-origin을 위쪽에 두고 rotate를 좌우로 아주 천천히 오가게 해, 매달린 세일 태그가 바람에 살랑이듯 보이게 합니다.
쓰임매달린 세일 태그, 알림 종 장식, 이벤트 배너 아이콘
rotatetransform-origin: top2.4s

<main class="stage">
<div class="tagwrap">
<span class="tagwrap__string" aria-hidden="true"></span>
<span class="tagwrap__tag o-yura">세일</span>
</div>
<span class="tag">살랑살랑</span>
</main>@use "../../../../site/static/demo-tokens" as *;
// ── 변수 3개 ──────────────────────────────────────────
$duration: 2.4s;
$easing: ease-in-out;
$color: $subject-blue;
// ── 데모 무대 ───────────────────────────────
@include stage($stage-paper);
.stage { position: relative; }
.tagwrap {
display: flex;
flex-direction: column;
align-items: center;
}
.tagwrap__string {
width: 2px;
height: 28px;
background: $stage-ink;
opacity: .4;
}
.tagwrap__tag {
padding: $sp-3 $sp-6;
border-radius: $r-sm;
background: $stage-ink;
color: $subject-cream;
font-weight: 700;
font-size: clamp(16px, 4.5vw, 20px);
line-height: 1;
font-family: inherit;
box-shadow: $shadow-raised;
transform-origin: top center; // 규칙8: 줄 매달림 top 피벗
}
.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;
}
// ── transform-origin 을 위쪽에 고정하고 rotate 만 아주 천천히 오간다 ─────
.o-yura {
animation: o-yura $duration $easing infinite;
color: $color;
}
@keyframes o-yura {
0%, 100% { transform: rotate(-6deg); }
50% { transform: rotate(6deg); }
}
// ── 접근성 ──────────────────────────────────────────
@media (prefers-reduced-motion: reduce) {
.o-yura { 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;
}
.tagwrap {
display: flex;
flex-direction: column;
align-items: center;
}
.tagwrap__string {
width: 2px;
height: 28px;
background: #17141a;
opacity: 0.4;
}
.tagwrap__tag {
padding: 12px 24px;
border-radius: 8px;
background: #17141a;
color: #fff7e6;
font-weight: 700;
font-size: clamp(16px, 4.5vw, 20px);
line-height: 1;
font-family: inherit;
box-shadow: 0 14px 24px rgba(23, 20, 26, 0.32);
transform-origin: top center;
}
.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;
}
.o-yura {
animation: o-yura 2.4s ease-in-out infinite;
color: #2f6df6;
}
@keyframes o-yura {
0%, 100% {
transform: rotate(-6deg);
}
50% {
transform: rotate(6deg);
}
}
@media (prefers-reduced-motion: reduce) {
.o-yura {
animation: none;
}
}import type { CSSProperties, ReactNode } from "react";
import styles from "./SwayTag.module.scss";
export type SwayTagProps = {
children: ReactNode;
/** 한 번 오가는 데 걸리는 시간 (기본 2400ms) */
duration?: number;
easing?: string;
color?: string;
};
type Vars = CSSProperties & {
"--duration"?: string;
"--easing"?: string;
"--color"?: string;
};
export default function SwayTag({
children,
duration = 2400,
easing = "ease-in-out",
color = "#2f6df6",
}: SwayTagProps) {
const vars: Vars = {
"--duration": `${duration}ms`,
"--easing": easing,
"--color": color,
};
return (
<div className={styles.wrap}>
<span className={styles.string} aria-hidden="true" />
<span className={styles.tag} style={vars}>
{children}
</span>
</div>
);
}04 살랑살랑 흔들리는(ゆらゆら) — 측정 누적면적 1.628% · 움직인 프레임 22/23GODRICH 원작 · zip 에 SCSS·React 포함 · CSS 통통 튀는 애니메이션 9종 — 한 줄 복붙으로
이 데모가 속한 글
CSS 통통 튀는 애니메이션 9종 — 한 줄 복붙으로CSS 통통 튀는 애니메이션은 요소를 그냥 나타나게 하지 않고 뜨고, 튕기고, 떨고, 흔들리게 만들어 살아 있는 느낌을 주는 움직임입니다. 흔한 영어 이름 대신 둥실둥실·포용·푸루푸루 같은 의성어로 아홉 개를 골랐고 이 글의 데모 전부 보기


