01Left-to-right wipe
A cover panel pinned at its right edge shrinks to scaleX(0), sweeping the photo open from left to right.
Best forPortfolio gallery thumbnails
scaleXtransform-origin500ms

<main class="stage">
<div class="wr-frame wr-focal is-demo">
<div class="wr-photo"></div>
<div class="wr-cover"></div>
</div>
</main>@use "../../../../site/static/demo-tokens" as *;
// ── 변수 3개 ──────────────────────────────────────────
$duration: $dur-enter;
$easing: $ease-out;
$color: $subject-blue;
@include stage($stage-ink);
.wr-frame {
position: relative;
width: min(260px, 78vw);
aspect-ratio: 8 / 5;
border-radius: $r-card;
overflow: hidden;
box-shadow: $shadow-raised;
}
.wr-photo {
position: absolute;
inset: 0;
background:
radial-gradient(120px circle at 72% 28%, rgba(255, 255, 255, .55), transparent 60%),
linear-gradient(150deg, $color, $subject-ink);
}
.wr-cover {
position: absolute;
inset: 0;
background: $subject-cream;
transform-origin: 100% 50%; // 규칙8: 오른쪽으로 걷힘
transform: scaleX(1);
}
// 실사용: 진짜 마우스 호버 — 오른쪽 끝을 축으로 scaleX(0) 까지 줄어들며 왼쪽부터 드러난다
.wr-cover { transition: transform $duration $easing; }
.wr-focal:hover .wr-cover { transform: scaleX(0); }
// 데모 루프: 같은 scaleX 경로를 keyframes 로 무한 재생 (캡처용)
@keyframes wr-wipe {
0% { transform: scaleX(1); }
8% { transform: scaleX(1); }
45% { transform: scaleX(0); }
60% { transform: scaleX(0); }
95% { transform: scaleX(1); }
100% { transform: scaleX(1); }
}
.wr-frame.is-demo .wr-cover { animation: wr-wipe $dur-loop $easing infinite; }
@media (prefers-reduced-motion: reduce) {
.wr-focal:hover .wr-cover,
.wr-frame.is-demo .wr-cover {
animation: none !important;
transition: none !important;
transform: scaleX(0) !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);
}
.wr-frame {
position: relative;
width: min(260px, 78vw);
aspect-ratio: 8/5;
border-radius: 16px;
overflow: hidden;
box-shadow: 0 14px 24px rgba(23, 20, 26, 0.32);
}
.wr-photo {
position: absolute;
inset: 0;
background: radial-gradient(120px circle at 72% 28%, rgba(255, 255, 255, 0.55), transparent 60%), linear-gradient(150deg, #2f6df6, #17141a);
}
.wr-cover {
position: absolute;
inset: 0;
background: #fff7e6;
transform-origin: 100% 50%;
transform: scaleX(1);
}
.wr-cover {
transition: transform 600ms ease-out;
}
.wr-focal:hover .wr-cover {
transform: scaleX(0);
}
@keyframes wr-wipe {
0% {
transform: scaleX(1);
}
8% {
transform: scaleX(1);
}
45% {
transform: scaleX(0);
}
60% {
transform: scaleX(0);
}
95% {
transform: scaleX(1);
}
100% {
transform: scaleX(1);
}
}
.wr-frame.is-demo .wr-cover {
animation: wr-wipe 2s ease-out infinite;
}
@media (prefers-reduced-motion: reduce) {
.wr-focal:hover .wr-cover,
.wr-frame.is-demo .wr-cover {
animation: none !important;
transition: none !important;
transform: scaleX(0) !important;
}
}import { CSSProperties } from "react";
import styles from "./WipeLeftRight.module.scss";
type Vars = CSSProperties & {
"--duration"?: string;
"--easing"?: string;
"--color"?: string;
};
export interface WipeLeftRightProps {
duration?: string;
easing?: string;
color?: string;
}
export default function WipeLeftRight({
duration = "600ms",
easing = "ease-out",
color = "#2f6df6",
}: WipeLeftRightProps) {
const style: Vars = {
"--duration": duration,
"--easing": easing,
"--color": color,
};
return (
<div className={styles.frame} style={style}>
<div className={styles.photo} />
<div className={styles.cover} />
</div>
);
}01 Left-to-right wipe — Measured area 29.128% · moving frames 18/23Original by GODRICH · SCSS and React ship in the zip · CSS Image Gallery Animation 9 One Line, Copy-Paste
The post this demo lives in
CSS Image Gallery Animation 9 One Line, Copy-PasteA css image gallery animation turns a photo that just pops onto the page into one that reveals itself — a cover sliding See all demos in this post


