08전송→정지 버튼 모핑
전송을 누르면 종이비행기 아이콘이 옅어지며 작아지고 그 자리에 정지 사각형이 scale과 opacity로 겹쳐 나타나, 버튼 모양은 그대로 두고 안의 아이콘만 바뀝니다.
쓰임전송→생성 중지 버튼, 재생→일시정지 토글
scaleopacity200ms

<main class="stage">
<button class="sm-btn is-demo" type="button" aria-label="Send message">
<svg class="sm-icon sm-icon--send" viewBox="0 0 24 24"><path d="M3 11l18-8-8 18-2-8-8-2z"/></svg>
<span class="sm-icon sm-icon--stop"></span>
</button>
</main>@use "../../../../site/static/demo-tokens" as *;
// ── 변수 3개 ──────────────────────────────────────────
$duration: $dur-loop;
$easing: $ease-spring;
$color: $subject-blue;
@include stage($stage-paper);
.sm-btn {
display: grid;
place-items: center;
width: $sp-12;
height: $sp-12;
border-radius: $r-pill;
border: none;
padding: 0;
background: $color;
box-shadow: $shadow-press;
}
.sm-icon {
grid-column: 1;
grid-row: 1;
}
.sm-icon--send {
width: $sp-5;
height: $sp-5;
path { fill: $subject-cream; }
}
.sm-icon--stop {
width: $sp-4;
height: $sp-4;
border-radius: $r-xs;
background: $subject-cream;
opacity: 0;
transform: scale(.5);
}
// 실사용: 전송을 누르면 한 번만 재생하고 정지 상태로 멈춘다. 데모는 오가며 반복 재생한다
@keyframes sm-send {
0%, 12% { opacity: 1; transform: scale(1); }
30%, 62% { opacity: 0; transform: scale(.5); }
80%, 100% { opacity: 1; transform: scale(1); }
}
@keyframes sm-stop {
0%, 12% { opacity: 0; transform: scale(.5); }
30%, 62% { opacity: 1; transform: scale(1); }
80%, 100% { opacity: 0; transform: scale(.5); }
}
.sm-btn.is-demo .sm-icon--send { animation: sm-send $duration $easing infinite; }
.sm-btn.is-demo .sm-icon--stop { animation: sm-stop $duration $easing infinite; }
@media (prefers-reduced-motion: reduce) {
.sm-btn.is-demo .sm-icon--send {
animation: none !important; opacity: 1 !important; transform: scale(1) !important;
}
.sm-btn.is-demo .sm-icon--stop {
animation: none !important; opacity: 0 !important; transform: scale(.5) !important;
}
}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);
}
.sm-btn {
display: grid;
place-items: center;
width: 48px;
height: 48px;
border-radius: 999px;
border: none;
padding: 0;
background: #2f6df6;
box-shadow: 0 6px 12px rgba(23, 20, 26, 0.32);
}
.sm-icon {
grid-column: 1;
grid-row: 1;
}
.sm-icon--send {
width: 20px;
height: 20px;
}
.sm-icon--send path {
fill: #fff7e6;
}
.sm-icon--stop {
width: 16px;
height: 16px;
border-radius: 4px;
background: #fff7e6;
opacity: 0;
transform: scale(0.5);
}
@keyframes sm-send {
0%, 12% {
opacity: 1;
transform: scale(1);
}
30%, 62% {
opacity: 0;
transform: scale(0.5);
}
80%, 100% {
opacity: 1;
transform: scale(1);
}
}
@keyframes sm-stop {
0%, 12% {
opacity: 0;
transform: scale(0.5);
}
30%, 62% {
opacity: 1;
transform: scale(1);
}
80%, 100% {
opacity: 0;
transform: scale(0.5);
}
}
.sm-btn.is-demo .sm-icon--send {
animation: sm-send 2s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}
.sm-btn.is-demo .sm-icon--stop {
animation: sm-stop 2s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}
@media (prefers-reduced-motion: reduce) {
.sm-btn.is-demo .sm-icon--send {
animation: none !important;
opacity: 1 !important;
transform: scale(1) !important;
}
.sm-btn.is-demo .sm-icon--stop {
animation: none !important;
opacity: 0 !important;
transform: scale(0.5) !important;
}
}import { CSSProperties } from "react";
import styles from "./StopButtonMorph.module.scss";
type Vars = CSSProperties & {
"--duration"?: string;
"--easing"?: string;
"--color"?: string;
};
export interface StopButtonMorphProps {
duration?: string;
easing?: string;
color?: string;
}
export default function StopButtonMorph({
duration = "2s",
easing = "cubic-bezier(.2, .8, .2, 1)",
color = "#2f6df6",
}: StopButtonMorphProps) {
const style: Vars = {
"--duration": duration,
"--easing": easing,
"--color": color,
};
return (
<button className={styles.btn} style={style} type="button" aria-label="Send message">
<svg className={`${styles.icon} ${styles.send}`} viewBox="0 0 24 24">
<path d="M3 11l18-8-8 18-2-8-8-2z" />
</svg>
<span className={`${styles.icon} ${styles.stop}`} />
</button>
);
}08 전송→정지 버튼 모핑 — 측정 누적면적 0.176% · 움직인 프레임 10/23GODRICH 원작 · zip 에 SCSS·React 포함 · AI 채팅 CSS 로딩 애니메이션 9종
이 데모가 속한 글
AI 채팅 CSS 로딩 애니메이션 9종ChatGPT나 Claude 같은 AI 채팅창에서 답이 오기를 기다릴 때 뜨는 점 세 개, 깜빡이는 커서, 서서히 나타나는 글자는 전부 CSS 로딩 애니메이션입니다. div 하나로 끝나는 아홉 가지를 코드와 함께 모 이 글의 데모 전부 보기

