04쿵 찍는 공
공이 떨어져 바닥에 닿는 순간 세로로 납작해졌다가 탄력으로 다시 튀어오르는 두 동작을 나눠 재고, transform-origin 을 바닥에 두어 찍히는 느낌을 살렸습니다.
쓰임게임형 서비스 로딩, 새로고침 버튼 옆 재미 요소
translateYscale(1.28, .55)transform-origin

<main class="stage">
<div class="sq-scene is-demo" aria-hidden="true">
<div class="sq-ball"></div>
<div class="sq-shadow"></div>
<div class="sq-floor"></div>
</div>
</main>@use "../../../../site/static/demo-tokens" as *;
// ── 변수 3개 ──────────────────────────────────────────
$duration: 1s;
$easing: cubic-bezier(.45, 0, .8, .6); // 떨어질 때: 점점 빨라지는 중력
$color: $subject-blue;
@include stage($stage-paper);
// 실사용: 로딩 중에만 .is-loading
.sq-scene {
position: relative;
width: 112px;
height: 164px;
}
.sq-ball {
position: absolute;
left: 50%;
bottom: 2px; // 바닥선(2px) 위에 정확히 얹힌다
width: 56px;
height: 56px;
margin-left: -28px;
border-radius: 50%;
background: $color;
transform-origin: 50% 100%; // 바닥에 닿은 채로 찍히게
}
.sq-shadow {
position: absolute;
left: 50%;
bottom: 0;
width: 56px;
height: $sp-1;
margin-left: -28px;
border-radius: $r-pill;
background: rgba(23, 20, 26, .22);
}
.sq-floor {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 2px;
background: $subject-ink;
}
.sq-scene.is-loading .sq-ball,
.sq-scene.is-demo .sq-ball {
animation: sq-bounce $duration $easing infinite;
}
.sq-scene.is-loading .sq-shadow,
.sq-scene.is-demo .sq-shadow {
animation: sq-shadow-pulse $duration $easing infinite;
}
@keyframes sq-bounce {
0% { transform: translateY(-98px) scale(1, 1); }
55% { transform: translateY(0) scale(1, 1); } // 바닥 도착
68% { transform: translateY(0) scale(1.28, .55); } // 쿵 — 찍힘
80% { transform: translateY(0) scale(.92, 1.08); } // 되튕기며 복원
100% { transform: translateY(-98px) scale(1, 1); }
}
@keyframes sq-shadow-pulse {
0%, 100% { transform: scale(.5); opacity: .3; }
55%, 80% { transform: scale(1.05); opacity: .75; }
}
@media (prefers-reduced-motion: reduce) {
.sq-scene.is-loading .sq-ball,
.sq-scene.is-demo .sq-ball {
animation: none !important;
transform: translateY(-40px) !important; // 정지해도 공중에 떠 있는 모양
}
.sq-scene.is-loading .sq-shadow,
.sq-scene.is-demo .sq-shadow {
animation: none !important;
opacity: .5 !important;
transform: scale(.8) !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);
}
.sq-scene {
position: relative;
width: 112px;
height: 164px;
}
.sq-ball {
position: absolute;
left: 50%;
bottom: 2px;
width: 56px;
height: 56px;
margin-left: -28px;
border-radius: 50%;
background: #2f6df6;
transform-origin: 50% 100%;
}
.sq-shadow {
position: absolute;
left: 50%;
bottom: 0;
width: 56px;
height: 4px;
margin-left: -28px;
border-radius: 999px;
background: rgba(23, 20, 26, 0.22);
}
.sq-floor {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 2px;
background: #17141a;
}
.sq-scene.is-loading .sq-ball,
.sq-scene.is-demo .sq-ball {
animation: sq-bounce 1s cubic-bezier(0.45, 0, 0.8, 0.6) infinite;
}
.sq-scene.is-loading .sq-shadow,
.sq-scene.is-demo .sq-shadow {
animation: sq-shadow-pulse 1s cubic-bezier(0.45, 0, 0.8, 0.6) infinite;
}
@keyframes sq-bounce {
0% {
transform: translateY(-98px) scale(1, 1);
}
55% {
transform: translateY(0) scale(1, 1);
}
68% {
transform: translateY(0) scale(1.28, 0.55);
}
80% {
transform: translateY(0) scale(0.92, 1.08);
}
100% {
transform: translateY(-98px) scale(1, 1);
}
}
@keyframes sq-shadow-pulse {
0%, 100% {
transform: scale(0.5);
opacity: 0.3;
}
55%, 80% {
transform: scale(1.05);
opacity: 0.75;
}
}
@media (prefers-reduced-motion: reduce) {
.sq-scene.is-loading .sq-ball,
.sq-scene.is-demo .sq-ball {
animation: none !important;
transform: translateY(-40px) !important;
}
.sq-scene.is-loading .sq-shadow,
.sq-scene.is-demo .sq-shadow {
animation: none !important;
opacity: 0.5 !important;
transform: scale(0.8) !important;
}
}import { CSSProperties } from "react";
import styles from "./SquishBall.module.scss";
type Vars = CSSProperties & {
"--duration"?: string;
"--easing"?: string;
"--color"?: string;
};
export interface SquishBallProps {
duration?: string;
easing?: string;
color?: string;
}
export default function SquishBall({
duration = "1s",
easing = "cubic-bezier(.45, 0, .8, .6)",
color = "#2f6df6",
}: SquishBallProps) {
const style: Vars = {
"--duration": duration,
"--easing": easing,
"--color": color,
};
return (
<div className={styles.scene} style={style} aria-hidden="true">
<div className={styles.ball} />
<div className={styles.shadow} />
<div className={styles.floor} />
</div>
);
}04 쿵 찍는 공 — 측정 누적면적 5.947% · 움직인 프레임 23/23GODRICH 원작 · zip 에 SCSS·React 포함 · 로딩페이지 디자인 9종 — 복붙하는 예쁜 CSS 로딩 화면
이 데모가 속한 글
로딩페이지 디자인 9종 — 복붙하는 예쁜 CSS 로딩 화면로딩페이지 디자인은 서비스가 켜지는 첫 순간에 사용자에게 "기다리고 있네"라고 말해주는 화면입니다. 기본 스피너 하나로도 되지만, 파스텔 링이나 차오르는 물처럼 예쁜 로딩 화면은 복붙 몇 줄로 사이트 인상을 바꿔 놓 이 글의 데모 전부 보기


