01숨쉬듯 확대+그림자
포트폴리오 그리드의 사진 타일에 마우스를 올리면 타일 전체가 transform: scale(1.04)로 살짝 커지면서 그림자가 깊어져, 숨을 쉬듯 부드럽게 반응합니다.
쓰임포트폴리오 프로젝트 타일, 제품 소개 그리드
scalebox-shadow300ms

<main class="stage">
<div class="bs-grid is-demo">
<div class="bs-tile bs-tile--a bs-focal">
<span class="bs-tile__tag">Project</span>
<span class="bs-tile__num">01</span>
</div>
<div class="bs-tile bs-tile--b">
<span class="bs-tile__tag">New</span>
</div>
<div class="bs-tile bs-tile--c">
<span class="bs-tile__tag">42%</span>
</div>
</div>
</main>@use "../../../../site/static/demo-tokens" as *;
// ── 변수 3개 ──────────────────────────────────────────
$duration: $dur-base;
$easing: $ease-spring;
$color: $subject-blue;
@include stage($stage-ink);
.bs-grid {
width: min(340px, 90vw);
aspect-ratio: 340 / 190;
display: grid;
grid-template-columns: 1.2fr 1fr;
grid-template-rows: 1fr 1fr;
gap: $sp-2;
}
.bs-tile {
border-radius: $r-sm;
display: flex;
flex-direction: column;
justify-content: flex-end;
padding: $sp-3;
box-sizing: border-box;
color: $subject-cream;
font: 600 12px/1 -apple-system, "Segoe UI", sans-serif;
}
.bs-tile--a {
grid-row: 1 / 3;
background: linear-gradient(160deg, $color, rgba(23, 20, 26, .85));
}
.bs-tile--b, .bs-tile--c {
background: rgba(255, 255, 255, .08);
}
.bs-tile__tag { opacity: .8; font-size: 11px; }
.bs-tile__num { font-size: 22px; font-weight: 700; margin-top: $sp-1; }
// 실사용: 진짜 마우스 호버로 트랜지션
.bs-focal {
transition: transform $duration $easing, box-shadow $duration $easing;
box-shadow: $shadow-press;
}
.bs-focal:hover {
transform: scale(1.04);
box-shadow: $shadow-raised;
}
// 데모 루프: is-demo 는 같은 모양을 keyframes 로 무한 재생 (캡처용 — 헤드리스는 :hover 를 못 건다)
@keyframes bs-breathe {
0%, 100% { transform: scale(1); box-shadow: $shadow-press; }
50% { transform: scale(1.04); box-shadow: $shadow-raised; }
}
.bs-grid.is-demo .bs-focal { animation: bs-breathe $duration $easing infinite; }
@media (prefers-reduced-motion: reduce) {
.bs-focal:hover,
.bs-grid.is-demo .bs-focal { animation: none !important; transform: none !important; box-shadow: $shadow-press !important; }
}html, body {
margin: 0;
overflow: hidden;
}
.stage {
box-sizing: border-box;
min-height: 100vh;
display: grid;
place-items: center;
margin: 0;
background: #17141a;
font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
padding: clamp(8px, 4vw, 24px);
}
.bs-grid {
width: min(340px, 90vw);
aspect-ratio: 340/190;
display: grid;
grid-template-columns: 1.2fr 1fr;
grid-template-rows: 1fr 1fr;
gap: 8px;
}
.bs-tile {
border-radius: 8px;
display: flex;
flex-direction: column;
justify-content: flex-end;
padding: 12px;
box-sizing: border-box;
color: #fff7e6;
font: 600 12px/1 -apple-system, "Segoe UI", sans-serif;
}
.bs-tile--a {
grid-row: 1/3;
background: linear-gradient(160deg, #2f6df6, rgba(23, 20, 26, 0.85));
}
.bs-tile--b, .bs-tile--c {
background: rgba(255, 255, 255, 0.08);
}
.bs-tile__tag {
opacity: 0.8;
font-size: 11px;
}
.bs-tile__num {
font-size: 22px;
font-weight: 700;
margin-top: 4px;
}
.bs-focal {
transition: transform 300ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 300ms cubic-bezier(0.2, 0.8, 0.2, 1);
box-shadow: 0 6px 12px rgba(23, 20, 26, 0.32);
}
.bs-focal:hover {
transform: scale(1.04);
box-shadow: 0 14px 24px rgba(23, 20, 26, 0.32);
}
@keyframes bs-breathe {
0%, 100% {
transform: scale(1);
box-shadow: 0 6px 12px rgba(23, 20, 26, 0.32);
}
50% {
transform: scale(1.04);
box-shadow: 0 14px 24px rgba(23, 20, 26, 0.32);
}
}
.bs-grid.is-demo .bs-focal {
animation: bs-breathe 300ms cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}
@media (prefers-reduced-motion: reduce) {
.bs-focal:hover,
.bs-grid.is-demo .bs-focal {
animation: none !important;
transform: none !important;
box-shadow: 0 6px 12px rgba(23, 20, 26, 0.32) !important;
}
}import { CSSProperties } from "react";
import styles from "./BreathScaleShadow.module.scss";
type Vars = CSSProperties & {
"--duration"?: string;
"--easing"?: string;
"--color"?: string;
};
export interface BreathScaleShadowProps {
duration?: string;
easing?: string;
color?: string;
}
export default function BreathScaleShadow({
duration = "300ms",
easing = "cubic-bezier(.2, .8, .2, 1)",
color = "#2f6df6",
}: BreathScaleShadowProps) {
const style: Vars = {
"--duration": duration,
"--easing": easing,
"--color": color,
};
return (
<div className={styles.grid} style={style}>
<div className={`${styles.tile} ${styles.tileA} ${styles.focal}`}>
<span className={styles.tag}>Project</span>
<span className={styles.num}>01</span>
</div>
<div className={`${styles.tile} ${styles.tileB}`}>
<span className={styles.tag}>New</span>
</div>
<div className={`${styles.tile} ${styles.tileC}`}>
<span className={styles.tag}>42%</span>
</div>
</div>
);
}01 숨쉬듯 확대+그림자 — 측정 누적면적 2.481% · 움직인 프레임 23/23GODRICH 원작 · zip 에 SCSS·React 포함 · 벤토 그리드 레이아웃 호버 애니메이션 9종
이 데모가 속한 글
벤토 그리드 레이아웃 호버 애니메이션 9종포트폴리오나 제품 소개 페이지에서 크고 작은 네모 칸이 사진 콜라주처럼 이어 붙은 레이아웃을 본 적 있으신가요? 이런 벤토 그리드 레이아웃에 마우스를 올렸을 때 칸마다 살짝 반응하게 만드는 CSS 코드를 아홉 가지로 이 글의 데모 전부 보기


