# 본문을 읽는 위치에 맞춰 장면 전환

SBS Australia · 스크롤 장면 · 2026년 11월 20일 확인

## 원본에서 본 동작

작품을 시작하면 여섯 장으로 이동하는 링크와 소리·자동 스크롤 제어가 나타납니다. 수동으로 읽거나 장을 골라 이동하는 작품 구성을 참고했습니다. Awwwards가 2015년 5월 7일 The Boat를 Site of the Day로 선정했습니다. 수상 대상은 작품 전체입니다. [SBS Australia 작품 The Boat](https://www.sbs.com.au/theboat/) · [제작 스튜디오의 구현 소개](https://www.distil.im/projects/the-boat) · [Awwwards 수상 기록](https://www.awwwards.com/sites/the-boat)

## 적용할 때

제조 과정, 프로젝트 변천, 데이터 리포트처럼 순서가 의미 있는 이야기에 씁니다. 원하는 정보 한 건만 찾는 주문·설정 화면에는 개별 링크가 더 빠릅니다.

모션랩의 인쇄 시안 《잔상집》에서 같은 능선과 해를 밑그림·색판·인쇄 순으로 보여줍니다. 브라우저가 선과 잉크를 직접 그리며 외부 이미지와 폰트 다운로드가 필요하지 않습니다. 단계 링크로 바로 이동하거나 위로 스크롤해 이전 판을 다시 볼 수 있습니다.

각 단계의 설명은 본문에 항상 남깁니다. 휴대폰에서는 그림과 단계 링크를 위에 고정하고 설명을 아래에서 스크롤합니다. 기본 판 교체는 270ms의 불투명도 전환입니다. 움직임 줄이기 설정과 URL의 `?reduce=1`에서는 즉시 끝 상태를 표시합니다.

## 확인하는 방법

휠로 아래로 읽고 다시 위로 올라갈 때 제목과 그림이 일치하는지, 단계 링크로 건너뛴 뒤에도 맞는지 확인합니다. 좁은 화면과 움직임 줄이기에서도 세 설명을 끝까지 읽어봅니다.

## 그대로 보낼 요청

> 브랜드 프로젝트의 제작 과정을 세 장으로 보여줘. 첫 시안, 교정, 완성본 순으로 글을 읽으면 옆의 그림도 그 단계로 바뀌고, 목차로 바로 건너뛸 수 있게 해줘.

[실행 데모 및 단일 HTML](../examples/scroll-chapters/index.html) · [사례 목록에서 보기](../tools/references.html#scroll-chapters)

## 실행 코드

아래 HTML 전체를 파일 하나로 저장해 브라우저에서 여세요. 예시의 문구·자료·코드는 이 라이브러리에서 작성했습니다.

<!-- standalone-example -->

```html
<!doctype html>
<html lang="ko"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title>잔상집 · 스크롤 장면 전환</title>
<script>
const labSettings=new URLSearchParams(location.search);
document.documentElement.classList.toggle('lab-embedded',labSettings.get('embed')==='1');
document.documentElement.classList.toggle('lab-reduce',labSettings.get('reduce')==='1');
</script>

<style>*{box-sizing:border-box}
:root{--paper:#eeeadc;--ink:#292c22;--muted:#666858;--accent:#9e3f26;color-scheme:light}
body{margin:0;background:var(--paper);color:var(--ink);font:15px/1.5 Inter,Pretendard,"Malgun Gothic",system-ui,sans-serif}
main{max-width:1200px;margin:0 auto;padding:clamp(22px,4vw,58px) clamp(16px,4vw,58px) 60px}
.intro{max-width:65ch;margin-bottom:24px}.intro h1{font-size:clamp(27px,4.5vw,55px);letter-spacing:-.07em;line-height:1.12;margin:0 0 8px}.intro p{margin:0;color:var(--muted)}
.pressroom{display:grid;grid-template-columns:minmax(0,1.58fr) minmax(180px,.75fr);align-items:start;gap:clamp(18px,4vw,66px)}
.mount{position:sticky;top:18px;margin:0;min-width:0;background:#d1cfbe;box-shadow:inset 0 1px #fff6}
.art{width:100%;height:clamp(240px,65vh,630px);display:flex;align-items:center;justify-content:center;background:linear-gradient(130deg,#dad9cc,#c9c6b5)}
.paper{position:relative;aspect-ratio:3/4;height:85%;max-width:88%;background:#f8f0d8;transform:rotate(-1.2deg);box-shadow:1px 1px 0 #817859,3px 6px 10px #35352636}
canvas{position:absolute;inset:0;width:100%;height:100%;opacity:0;transition:opacity .27s ease-out}
figure[data-scene="sketch"] .pass-sketch,figure[data-scene="ink"] .pass-ink,figure[data-scene="print"] .pass-print{opacity:1}
figcaption{display:flex;justify-content:space-between;align-items:center;border-top:1px solid #abaa95;color:#4a4e3c;padding:8px 12px;font:550 10px/1.4 Consolas,monospace;letter-spacing:.045em}
figcaption strong{font:650 12px/1.3 Inter,Pretendard,system-ui,sans-serif;letter-spacing:0}
main nav{position:sticky;top:0;z-index:2;display:flex;gap:0;padding:0;background:var(--paper);border-bottom:1px solid #aaa994;margin:0}
main nav a{color:var(--muted);padding:12px 9px;font-weight:650;font-size:12px;text-decoration:none;white-space:nowrap;border-bottom:2px solid transparent}
main nav a:first-child{padding-left:0}main nav a[aria-current]{color:var(--accent);border-bottom-color:var(--accent)}
section.chapter{min-height:74vh;padding:clamp(24px,5vw,80px) 0;scroll-margin-top:45px;border-bottom:1px solid #b8b7a5}
.chapter .sequence{font:550 11px/1.2 Consolas,monospace;color:#615b45;letter-spacing:.06em}
.chapter h2{font-size:clamp(22px,3vw,38px);line-height:1.12;letter-spacing:-.065em;margin:10px 0 12px}
.chapter p{font-size:clamp(13px,1.35vw,17px);line-height:1.65;margin:0;word-break:keep-all}
.lab-embedded .intro{display:none}
.lab-embedded main{padding-top:clamp(16px,2vw,28px)}
.lab-reduce *{transition:none!important;scroll-behavior:auto!important}
a:focus-visible{outline:3px solid #875032;outline-offset:2px}
@media(max-width:600px){
 main{padding:16px 16px 36px}.intro{margin:8px 0 18px}
 .pressroom{display:flex;flex-direction:column;gap:0}
 .mount{top:0;width:100%;z-index:2;--art-height:clamp(125px,43vh,330px)}
 .art{height:var(--art-height)}figcaption{padding:5px 9px}
 .chapters{width:100%}main nav{top:calc(clamp(125px,43vh,330px) + 27px);background:var(--paper);z-index:2}
 main nav a{padding:10px 13px}.lab-embedded main{padding:0 12px 30px}.lab-embedded .mount{width:calc(100% + 24px);margin-inline:-12px}
 section.chapter{min-height:66vh;padding:17px 2px 50px;scroll-margin-top:calc(clamp(125px,43vh,330px) + 78px)}
}
@media(max-height:380px){.pressroom{display:grid;grid-template-columns:minmax(0,1fr) minmax(150px,.8fr);gap:18px}.art{height:70vh}.mount{width:auto!important;margin:0!important;top:0}.chapters nav{top:0}section.chapter{scroll-margin-top:42px}}
@media(prefers-reduced-motion:reduce){canvas{transition:none}}</style></head>
<body class="lab-example">

<main><header class="intro"><h1>잔상집</h1><p>포스터에 선을 긋고 색을 맞춰 찍는 세 단계를 스크롤해 보세요.</p></header>
<div class="pressroom"><figure class="mount" data-scene="sketch" role="img" aria-label="잔상집 포스터 제작 단계">
  <div class="art"><div class="paper"><canvas class="pass-sketch" aria-hidden="true"></canvas><canvas class="pass-ink" aria-hidden="true"></canvas><canvas class="pass-print" aria-hidden="true"></canvas></div></div>
  <figcaption><strong>밑그림</strong><span>PLATE 01 / 03</span></figcaption>
</figure><div class="chapters"><nav aria-label="제작 단계"><a href="#sketch" aria-current="step">밑그림</a><a href="#ink">색판</a><a href="#print">인쇄</a></nav>
<section id="sketch" class="chapter"><span class="sequence">01 / 03</span><h2>밑그림</h2><p>능선을 세 겹으로 나누고, 가장 먼 산 너머에 해를 둡니다. 곡선 사이의 간격으로 산의 깊이를 잡습니다.</p></section>
<section id="ink" class="chapter"><span class="sequence">02 / 03</span><h2>색판</h2><p>해와 먼 산에는 주홍 잉크를 먼저 얹습니다. 두 번째 판이 비치는 곳에서 중간 산의 녹색이 만들어집니다.</p></section>
<section id="print" class="chapter"><span class="sequence">03 / 03</span><h2>인쇄</h2><p>가까운 산의 어두운 색과 제목을 마지막으로 찍습니다. 종이색을 남겨 둔 가는 선들이 능선을 드러냅니다.</p></section>
</div></div></main>

<script>
const passes = ['sketch','ink','print'];

// All marks and contours are drawn from this composition. Render the three
// plates once so scrolling only crossfades between finished canvases.
function drawPoster(canvas, pass) {
  const c = canvas.getContext('2d');
  if (!c) return;
  const W=720, H=960;
  canvas.width=W; canvas.height=H;
  let state=863171;
  const noise=()=>{state=(Math.imul(state,1664525)+1013904223)>>>0;return state/4294967296};
  const ink=pass==='sketch'?'#897f65':'#273c36';
  const completed=pass==='print';
  c.fillStyle='#f3e8c9';c.fillRect(0,0,W,H);
  for (let i=0;i<17500;i++) {
    const dotSize=noise()*2.4+.5;
    c.fillStyle=noise()>.5?'rgba(85,58,26,.075)':'rgba(255,255,240,.22)';
    c.fillRect(noise()*W,noise()*H,dotSize,dotSize*.58);
  }
  const text=(s,x,y,font,color,align='left')=>{c.font=font;c.fillStyle=color;c.textAlign=align;c.fillText(s,x,y)};
  const rule=(x1,y1,x2,y2,color,width=1)=>{c.beginPath();c.moveTo(x1,y1);c.lineTo(x2,y2);c.strokeStyle=color;c.lineWidth=width;c.stroke()};
  const top=155,bottom=779,left=42,right=W-42;
  const field=() => {c.beginPath();c.rect(left,top,right-left,bottom-top);c.clip()};
  const pencil='#988c71';
  c.save();field();
  if(pass==='sketch'){
    for(let x=left;x<right;x+=52)rule(x,top,x,bottom,'#c1b499',.55);
    for(let y=top;y<bottom;y+=52)rule(left,y,right,y,'#c1b499',.55);
  }
  const cx=442,cy=360,r=151;
  c.save();c.beginPath();c.arc(cx,cy,r,0,Math.PI*2);c.clip();
  if(pass!=='sketch'){c.fillStyle=completed?'#c95330':'#d96b3d';c.fillRect(cx-r,cy-r,2*r,2*r)}
  for(let y=-r;y<=r;y+=5){
    const chord=Math.sqrt(r*r-y*y);
    const drift=2.8*Math.sin(y*.065);
    rule(cx-chord+drift,cy+y,cx+chord,cy+y+(pass==='sketch'?0:3),pass==='sketch'?'#a79a7f':'#efae72',pass==='sketch'?.5:.85);
  }
  c.restore();
  c.beginPath();c.arc(cx,cy,r,0,Math.PI*2);c.lineWidth=1;c.strokeStyle=pass==='sketch'?pencil:'#c46c43';c.stroke();
  function crest(x,ridge) {
    const a=x/W;
    return [515,626,716][ridge]-[91,107,75][ridge]*Math.sin(a*4.15+ridge*.68)
      +26*Math.sin(a*10.5+ridge*1.31)+12*Math.sin(a*19.3+.75*ridge)+5*Math.sin(a*39.1+.6*ridge);
  }
  for(let ridge=0;ridge<3;ridge++){
    const outline=()=>{c.beginPath();for(let x=left;x<=right+4;x+=3){const y=crest(x,ridge);if(x===left)c.moveTo(x,y);else c.lineTo(x,y)}};
    c.save();outline();c.lineTo(right+5,bottom+2);c.lineTo(left-2,bottom+2);c.closePath();
    c.fillStyle=pass==='sketch'?'#eee4c7':(completed?['#d58856','#768471','#283e37']:['#d89b65','#ab9b68','#758875'])[ridge];
    c.fill();c.clip();
    for(let j=0;j<105;j++){
      c.beginPath();
      for(let x=left-2;x<=right+3;x+=4){
        const d=j*(completed?4.2:5.2);
        const y=crest(x,ridge)+d+Math.sin(x*.021+j*.11)*Math.min(13,j*.38)+Math.sin(x*.061+j)*.8;
        if(x===left-2)c.moveTo(x,y);else c.lineTo(x,y);
      }
      c.strokeStyle=pass==='sketch'?'rgba(107,98,73,.46)':(completed?['#a6653f','#4d6c60','#a8ad8e'][ridge]:['#9f714d','#607664','#c2b68e'][ridge]);
      c.lineWidth=pass==='sketch'?.75:(ridge===2?1.35:1.1);
      c.stroke();
    }
    c.restore();outline();c.strokeStyle=pass==='sketch'?pencil:ink;c.lineWidth=pass==='sketch'?.8:1.25;c.stroke();
  }
  c.restore();
  [left,right].forEach(x=>[top,bottom].forEach(y=>{rule(x-8,y,x+8,y,'#635d4d',1);rule(x,y-8,x,y+8,'#635d4d',1)}));
  text('MOTION LAB   /   PRINT STUDIES',left,56,'600 14px Consolas, monospace',ink);
  text('EDITION 01',right,56,'600 14px Consolas, monospace',ink,'right');
  rule(left,76,right,76,'#8e8469',1);
  text('AFTERIMAGE',left,129,'bold 51px Georgia, serif',pass==='sketch'?'#93896f':ink);
  if(completed){
    text('잔상집',left,866,'bold 67px "Malgun Gothic", sans-serif',ink);
    text('Landscape',right,837,'italic 30px Georgia, serif',ink,'right');
    text('in three plates.',right,870,'italic 30px Georgia, serif',ink,'right');
  } else {
    c.save();c.strokeStyle=pencil;c.lineWidth=1;c.font='bold 67px "Malgun Gothic",sans-serif';c.textAlign='left';c.strokeText('잔상집',left,866);c.restore();
    for(let y=821;y<862;y+=13)rule(right-120,y,right,y,pencil,1);
  }
  rule(left,901,right,901,'#8e8469',1);
  text('FIELD NOTES  /  LANDSCAPE NO.01',left,929,'600 14px Consolas, monospace',ink);
  text('ML–053',right,929,'600 14px Consolas, monospace',ink,'right');
}
passes.forEach(name=>drawPoster(document.querySelector('.pass-'+name),name));
const chapters = Array.from(document.querySelectorAll('.chapter'));
const links = Array.from(document.querySelectorAll('main nav a'));
const figure = document.querySelector('figure');
const caption = figure.querySelector('figcaption');
let pending = false;
function updateScene(){
  pending = false;
  const narrow = innerWidth<=600 && innerHeight>380;
  const navBottom = document.querySelector('main nav').getBoundingClientRect().bottom;
  const marker = narrow ? Math.min(innerHeight-4,Math.max(innerHeight*.48,navBottom+21)) : innerHeight*.46;
  let index = 0;
  for(let i=1;i<chapters.length;i++) if(chapters[i].getBoundingClientRect().top<=marker) index=i;
  if(scrollY+innerHeight >= document.documentElement.scrollHeight-2) index=chapters.length-1;
  const chapter = chapters[index], name=chapter.querySelector('h2').textContent;
  figure.dataset.scene=chapter.id;
  figure.setAttribute('aria-label','잔상집 포스터, '+name);
  caption.querySelector('strong').textContent=name;
  caption.querySelector('span').textContent='PLATE 0'+(index+1)+' / 03';
  links.forEach((link,i)=>{if(i===index)link.setAttribute('aria-current','step');else link.removeAttribute('aria-current')});
}
function schedule(){if(!pending){pending=true;requestAnimationFrame(updateScene)}}
window.addEventListener('scroll',schedule,{passive:true});
window.addEventListener('resize',schedule);
window.addEventListener('pageshow',schedule);
window.addEventListener('hashchange',schedule);
updateScene();
</script></body></html>
```
