Codrops 사례 연구

Depth without drift.

섹션 · MIT

섹션 더 보기
CASE STUDY
Depth without drift. 정적 미리보기

갤러리 안에서는 화면을 벗어나거나 움직임을 멈추면 예제도 닫힙니다. 다시 재생할 때는 처음부터 시작해요.

큰 화면으로 보기 새 탭실행 HTML 저장

저장한 HTML에서는 갤러리의 재생 설정이 적용되지 않아요.

SOURCE FILES

독립 예제 코드 읽기

7개 파일

사례의 구도나 문서의 원리를 바탕으로 새로 만든 예제입니다. 아래 코드를 복사해 직접 응용할 수 있습니다. 실행 HTML에는 미리보기를 위한 실행 환경이 들어 있습니다.

index.html독립 구현

큰 소스 파일과 이미지·모델 등의 자료는 파일을 저장해 확인할 수 있어요.

styles.css독립 구현
파일 저장

/* Generated by scripts/build-codrops-article-studies.mjs.
MIT License

Copyright (c) 2026 StyleGallery contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Scope: independently authored study HTML, CSS, JavaScript, shaders and SVG only. Original articles, source projects, brands, artwork and screenshots are excluded. Their licenses and acquisition dispositions are unchanged.
*/

*{box-sizing:border-box}html{color-scheme:dark}html,body{margin:0;min-height:100%}body{background:var(--paper,#0c1321);color:var(--ink,#f4f3e9);font-family:Arial,Helvetica,sans-serif}button,input,select{font:inherit}button,select,input{min-width:0}button{background:transparent;border:1px solid #ffffff40;border-radius:999px;color:inherit;cursor:pointer;min-height:40px;padding:10px 16px}button:hover{background:#ffffff15}button[aria-pressed=true]{background:var(--accent,#dbff78);border-color:transparent;color:#122014}button:disabled{cursor:default;opacity:.6}button:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible,a:focus-visible{outline:3px solid var(--accent,#dbff78);outline-offset:4px}input,select{accent-color:var(--accent,#dbff78)}select,input[type=text],input[type=number]{background:#132235;border:1px solid #ffffff50;border-radius:7px;color:#fff;min-height:38px;padding:8px;width:100%}input[type=range]{display:block;min-height:30px;width:100%}a{color:inherit}svg{display:block;max-width:100%}h1,h2,p,figure{margin:0}h1{font-size:clamp(36px,6.5vw,78px);font-weight:500;letter-spacing:-.06em;line-height:.99}h2{font-size:24px;font-weight:500;letter-spacing:-.025em}p{line-height:1.55}.study{isolation:isolate;min-height:100vh;padding:clamp(18px,3.8vw,48px)}.masthead{align-items:center;display:flex;flex-wrap:wrap;font:10px/1.5 ui-monospace,monospace;gap:16px;justify-content:space-between;letter-spacing:.11em;margin-bottom:35px;text-transform:uppercase}.masthead strong{font-size:12px;letter-spacing:-.02em}.intro{display:grid;gap:18px;grid-template-columns:minmax(0,1.5fr) minmax(0,1fr);margin-bottom:30px;align-items:end}.intro p{color:var(--muted,#b7c7d4);font-size:13px;max-width:38em}.eyebrow{color:var(--accent,#dbff78);font:10px/1.4 ui-monospace,monospace;letter-spacing:.14em;margin-bottom:12px;text-transform:uppercase}.workbench{display:grid;gap:20px;grid-template-columns:minmax(0,1fr) 230px}.visual{background:var(--surface,#101d2b);border:1px solid #ffffff20;border-radius:20px;min-width:0;overflow:hidden;position:relative}.drawing{height:auto;width:100%}.art-canvas{aspect-ratio:1.55;display:block;height:auto;width:100%}.panel{align-content:start;display:grid;gap:17px}.control{display:grid;font-size:11px;gap:7px;min-width:0}.control>span{display:flex;gap:10px;justify-content:space-between}.control output{color:var(--accent,#dbff78);font-family:ui-monospace,monospace}.controls{display:flex;flex-wrap:wrap;gap:8px}.readout{background:#ffffff09;border:1px solid #ffffff18;border-radius:12px;font:11px/1.7 ui-monospace,monospace;overflow-wrap:anywhere;padding:14px;white-space:pre-line}.legend{align-items:center;display:flex;flex-wrap:wrap;font:10px/1.6 ui-monospace,monospace;gap:16px;padding:16px 20px}.legend i{background:var(--accent,#dbff78);border-radius:50%;display:inline-block;height:6px;margin-right:6px;width:6px}.contract{border-top:1px solid #ffffff20;color:var(--muted,#b7c7d4);font-size:11px;margin-top:28px;padding-top:18px}.contract summary{color:var(--ink,#f4f3e9);cursor:pointer;font-size:12px}.contract p{margin-top:10px;max-width:90ch}.motion-bar{align-items:center;border-top:1px solid #ffffff20;display:flex;flex-wrap:wrap;font-size:11px;gap:12px;justify-content:space-between;margin-top:26px;padding-top:18px}.motion-bar label{align-items:center;display:flex;gap:8px}.feedback{color:var(--muted,#b7c7d4);font:11px/1.5 ui-monospace,monospace;min-height:18px}.visually-hidden{clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;width:1px}[hidden]{display:none!important}.stage-note{background:#07111ac9;bottom:18px;color:#dfe8f0;font:11px/1.5 ui-monospace,monospace;left:18px;max-width:calc(100% - 36px);padding:8px 12px;position:absolute;z-index:2}.big-number{font-size:clamp(70px,14vw,180px);letter-spacing:-.08em;line-height:1}.plain-list{display:grid;gap:12px;list-style:none;margin:0;padding:0}.plain-list li{border-bottom:1px solid #ffffff20;padding:12px 0}.tabs{display:flex;flex-wrap:wrap;gap:7px}.tabs button{font-size:11px}.two{display:grid;gap:20px;grid-template-columns:1fr 1fr}.code-sample{color:#c9ecbe;font:11px/1.7 ui-monospace,monospace;overflow:auto;white-space:pre-wrap}.fallback{padding:30px}.fallback p{max-width:38ch}.static-gallery{display:none}.study[data-reduced=true] .static-gallery{display:grid}.study[data-reduced=true] .animated-story{display:none}.study[data-reduced=true] *{animation:none!important;transition:none!important}body[data-preview-status=error] .feedback{color:#ffbba3}@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;scroll-behavior:auto!important;transition:none!important}}@media(max-width:700px){.intro{grid-template-columns:1fr}.workbench{grid-template-columns:1fr}.panel{grid-template-columns:repeat(2,minmax(0,1fr))}.panel>.readout,.panel>.controls{grid-column:1/-1}.masthead{margin-bottom:26px}.two{grid-template-columns:1fr}}@media(max-width:380px){.panel{gap:12px}.control{font-size:10px}.panel button{font-size:11px;padding:9px 12px}.legend{gap:8px;padding:12px}.visual{border-radius:13px}}

.projection-lab{background:radial-gradient(ellipse at 50% 25%,#154e4e,#071e22 75%)}.projection-tag{display:flex;flex-wrap:wrap;font:9px/1.5 ui-monospace,monospace;gap:8px;justify-content:space-between;padding:18px 20px}.projection-tag span:first-child{color:#74efd4}.projection-frame{--projection-height-limit:570px;--projection-aspect:1.4;aspect-ratio:var(--projection-aspect);background:#041e2438;margin-inline:auto;outline:1px solid #b5f6db33;position:relative;width:min(100%,calc(var(--projection-height-limit)*var(--projection-aspect)))}.projection-frame canvas{display:block;height:100%;width:100%}.projection-overlay{height:100%;inset:0;pointer-events:none;position:absolute;width:100%}.projection-stats{border-top:1px solid #ffffff25;display:grid;gap:18px;grid-template-columns:1fr 1fr;padding:17px 20px}.projection-stats>div{display:grid;gap:6px}.projection-stats span{color:#c7dcd3;font:9px ui-monospace,monospace}.projection-stats output{color:#f4efcd;font:clamp(12px,1.7vw,23px) ui-monospace,monospace}.projection-lab .legend{font-size:8px}@media(max-width:380px){.projection-stats{gap:10px;padding:14px}.projection-stats output{font-size:11px}.projection-tag{font-size:8px;padding:14px}}@media(max-height:550px) and (min-width:500px){.projection-tag{font-size:7px;padding:10px 12px}.projection-frame{--projection-height-limit:210px}.projection-stats{gap:10px;padding:10px 12px}.projection-stats span{font-size:7px}.projection-stats output{font-size:11px}.projection-lab .legend{font-size:7px}}

@media(max-height:550px) and (min-width:500px){
.study{padding:18px}.masthead{font-size:8px;gap:10px;margin-bottom:16px}.masthead strong{font-size:10px}.intro{gap:18px;grid-template-columns:minmax(0,1.25fr) minmax(0,1fr);margin-bottom:18px}.intro h1{font-size:34px}.intro p{font-size:10px;line-height:1.5}.intro .eyebrow{font-size:8px;margin-bottom:8px}.workbench{gap:16px;grid-template-columns:minmax(0,1fr) 174px}.panel{gap:10px;grid-template-columns:1fr}.panel .control{font-size:9px;gap:3px}.panel .control input[type=range]{min-height:22px}.panel select,.panel input[type=text],.panel input[type=number]{font-size:10px;min-height:31px;padding:6px}.panel .controls{gap:5px}.panel button{font-size:9px;min-height:30px;padding:7px 10px}.panel .readout{font-size:8px;padding:10px}.art-canvas{aspect-ratio:auto!important;height:250px;object-fit:contain}.legend{font-size:8px;gap:8px;padding:10px 13px}.stage-note{bottom:12px;font-size:8px;left:12px;padding:5px 8px}.type-lab{min-height:280px;padding:23px}.type-heading{font-size:36px}.particle-rack{height:80px}.type-rule{font-size:7px}.bounce-lab>.drawing{height:230px;object-fit:contain}.track-graph{padding:9px 16px}.track-graph svg{height:43px}.member-lab{min-height:300px;padding:18px}.member-heading h2{font-size:24px}.member-collage{height:180px}.member-total .counter{font-size:52px}.member-total>span{font-size:7px}.member-card span{font-size:6px;padding:4px}.composer-surface{padding:20px}.composer-label{font-size:8px;margin-bottom:20px}.form-set{gap:10px}.form-set h2{font-size:20px;margin-top:12px}.form-set p{font-size:9px}.timeline-rows{padding:12px 17px}.mascot-lab>.drawing{height:250px;object-fit:contain}.pose-strip{padding:10px 14px}.pose-marker{font-size:8px;padding:6px 0}.fit-stage{min-height:270px;padding:20px}.fit-stage canvas{max-height:235px}.tree-columns{grid-template-columns:125px minmax(0,1fr);min-height:320px}.tree-inspector{padding:17px 12px}.tree-inspector pre{font-size:8px;margin-top:18px}.tree-rules{display:none}.tree-preview{min-height:0;padding:14px}.tree-width-label,.tree-caption{font-size:7px}.fixture-copy h2{font-size:1.6em}.fixture-copy p{font-size:.65em}.fixture-output{gap:10px;padding:12px}.fixture-art{max-height:90px}.semantic-lab{grid-template-columns:110px minmax(0,1fr);min-height:320px}.node-list{flex-direction:column;padding:12px 7px}.node-list button{font-size:8px;gap:5px;padding:9px 7px}.node-list button small{font-size:7px}.semantic-preview{padding:14px}.semantic-fixture{padding:8px}.semantic-fixture h2{font-size:27px}.semantic-fixture p{font-size:10px}.semantic-art{height:75px}.markup-panel{padding:15px}.markup-panel pre{font-size:8px}.plant-lab{padding:18px}.plant-heading h2{font-size:28px}.plant-heading span{font-size:8px}.plant-illustration{margin:-60px 0 -8px}.plant-illustration svg{height:250px}.plant-callouts{gap:5px}.plant-callouts button{font-size:7px;min-height:28px;padding:7px}.plant-feature,.care-plan{font-size:10px}.orbit-lab{min-height:300px}.orbit-camera{height:270px}.orbit-ring{height:170px;width:110px}.orbit-card{height:170px;width:110px}.orbit-foot{font-size:8px;padding:10px 14px}.botanical-window{aspect-ratio:1.5}.window-label h2{font-size:29px}.window-label span{font-size:8px}.gold-lab{padding:18px}.gold-heading h2{font-size:28px;margin-top:9px}.gold-heading>span,.gold-total>span{font-size:7px}.gold-lab>svg{height:175px;margin:-27px 0 -6px}.gold-total{padding-top:9px}.gold-total output{font-size:43px}.gold-disclaimer{font-size:9px}.story-controls{gap:10px;grid-template-columns:repeat(4,minmax(0,1fr));padding:10px 0;position:relative}.story-controls .control{font-size:8px}.story-controls input[type=range]{min-height:20px}.story-controls>.controls{grid-column:auto}.story-controls button{font-size:8px;min-height:27px;padding:6px 8px}.story-pin{top:10px}.story-pin>.visual{min-height:270px}.story-pin .art-canvas{height:270px}.story-copy{bottom:20px;left:20px;max-width:255px}.story-chapter h2{font-size:29px;margin:8px 0}.story-chapter p{font-size:10px}.story-chapter>span{font-size:8px}.moon-lab{aspect-ratio:auto;min-height:270px}.moon-progress,.cylinder-energy,.terrain-coordinates{font-size:8px}.story-skip{font-size:9px;margin-bottom:10px}.reading-chapter{grid-template-columns:1fr 1fr}.motion-bar{margin-top:18px}
}
함께 쓰는 파일 5개 보기
script.js독립 구현
파일 저장

/* Generated by scripts/build-codrops-article-studies.mjs.
MIT License

Copyright (c) 2026 StyleGallery contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Scope: independently authored study HTML, CSS, JavaScript, shaders and SVG only. Original articles, source projects, brands, artwork and screenshots are excluded. Their licenses and acquisition dispositions are unchanged.
*/
(() => {
'use strict';
const id="codrops-2037f8fa6eb9",stage=document.querySelector('.study');
const preview=window.__STYLEGALLERY_PREVIEW__={id,status:'loading',errors:[]};
const report=error=>{const message=error instanceof Error?error.message:String(error);if(!preview.errors.includes(message))preview.errors.push(message);preview.status='error';document.body.dataset.previewStatus='error';parent.postMessage({type:'sg-preview-error',id,message},'*');const feedback=document.querySelector('[data-feedback]');if(feedback)feedback.textContent=message;};
addEventListener('error',event=>report(event.error||event.message));addEventListener('unhandledrejection',event=>report(event.reason));
const $=selector=>stage.querySelector(selector),$$=selector=>[...stage.querySelectorAll(selector)];
const value=key=>$('[data-control="'+key+'"]').value,number=key=>Number(value(key));
const clamp=(x,a=0,b=1)=>Math.max(a,Math.min(b,x)),lerp=(a,b,t)=>a+(b-a)*t;
const setText=(selector,text)=>{const node=$(selector);if(node)node.textContent=text;};
const media=matchMedia('(prefers-reduced-motion: reduce)');
let isReduced=media.matches,playing=false,time=0,draw=()=>{},raf=0,last=0,disposed=false;
const cleanups=[],on=(target,type,fn,options)=>{target.addEventListener(type,fn,options);cleanups.push(()=>target.removeEventListener(type,fn,options));};
const listen=(key,fn)=>on($('[data-action="'+key+'"]'),'click',fn);
const repaint=()=>{if(!disposed){try{draw(0);}catch(error){report(error);}}};
const loop=now=>{raf=0;if(disposed||!playing||isReduced)return;const dt=Math.min((now-last)/1000,.05);last=now;time+=dt;try{draw(dt);}catch(error){report(error);stop();return;}raf=requestAnimationFrame(loop);};
function stop(){playing=false;cancelAnimationFrame(raf);raf=0;$$('[data-play]').forEach(button=>{button.setAttribute('aria-pressed','false');button.textContent=isReduced?'Static view active':'Play motion';});}
function start(){if(isReduced)return;playing=true;last=performance.now();$$('[data-play]').forEach(button=>{button.setAttribute('aria-pressed','true');button.textContent='Pause motion';});if(!raf)raf=requestAnimationFrame(loop);}
function applyMotionPreference(){isReduced=media.matches||$('[data-static]').checked;stage.dataset.reduced=String(isReduced);if(isReduced)stop();$$('[data-play]').forEach(button=>{button.disabled=isReduced;button.textContent=playing?'Pause motion':isReduced?'Static view active':'Play motion';});repaint();}
function install(render){draw=render;applyMotionPreference();}
const observe=()=>{const root=document.getElementById('root'),elements=[...root.querySelectorAll('*')],rect=root.getBoundingClientRect();parent.postMessage({type:'sg-preview-observation',id,diagnostics:{textLength:root.textContent.trim().length,elementCount:elements.length,visibleElementCount:elements.filter(element=>{const r=element.getBoundingClientRect(),s=getComputedStyle(element);return r.width>0&&r.height>0&&s.display!=='none'&&s.visibility!=='hidden'&&Number(s.opacity)!==0;}).length,images:[],canvases:$$('canvas').map(c=>({width:c.width,height:c.height})),rootRect:{width:rect.width,height:rect.height},documentWidth:document.documentElement.scrollWidth,viewportWidth:innerWidth}},'*');};
on(media,'change',applyMotionPreference);on($('[data-static]'),'change',applyMotionPreference);
$$('[data-play]').forEach(button=>on(button,'click',()=>playing?stop():start()));
$$('[data-control]').forEach(input=>on(input,'input',()=>{const output=$('[data-value="'+input.dataset.control+'"]');if(output)output.textContent=input.value;if(input.dataset.control!=='story')repaint();}));
on(document,'visibilitychange',()=>{if(document.hidden)stop();});
on(window,'pagehide',()=>{disposed=true;stop();cleanups.forEach(fn=>fn());});
function canvas2D(selector,width=900,height=580){const canvas=$(selector);canvas.width=width;canvas.height=height;const context=canvas.getContext('2d');if(!context)throw Error('A 2D drawing surface is unavailable.');return {canvas,ctx:context,width,height};}
function createGL(canvas,fragment,vertex){const gl=canvas.getContext('webgl',{alpha:false,antialias:true,preserveDrawingBuffer:true});if(!gl){canvas.hidden=true;const fallback=$('[data-gl-fallback]');if(fallback)fallback.hidden=false;throw Error('WebGL is unavailable. The study explanation and controls remain readable.');}
 const shader=(type,source)=>{const s=gl.createShader(type);gl.shaderSource(s,source);gl.compileShader(s);if(!gl.getShaderParameter(s,gl.COMPILE_STATUS))throw Error(gl.getShaderInfoLog(s));return s;};
 const vs=shader(gl.VERTEX_SHADER,vertex||'attribute vec2 aPosition;varying vec2 vUv;void main(){vUv=aPosition*.5+.5;gl_Position=vec4(aPosition,0.,1.);}'),fs=shader(gl.FRAGMENT_SHADER,fragment),program=gl.createProgram();gl.attachShader(program,vs);gl.attachShader(program,fs);gl.linkProgram(program);if(!gl.getProgramParameter(program,gl.LINK_STATUS))throw Error(gl.getProgramInfoLog(program));gl.useProgram(program);
 const buffer=gl.createBuffer();gl.bindBuffer(gl.ARRAY_BUFFER,buffer);if(!vertex){gl.bufferData(gl.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]),gl.STATIC_DRAW);const location=gl.getAttribLocation(program,'aPosition');gl.enableVertexAttribArray(location);gl.vertexAttribPointer(location,2,gl.FLOAT,false,0,0);}
 const uniforms=new Map(),uniform=(name,...args)=>{if(!uniforms.has(name))uniforms.set(name,gl.getUniformLocation(program,name));const location=uniforms.get(name);if(location===null)return;if(args[0] instanceof Float32Array)gl.uniform3fv(location,args[0]);else gl['uniform'+args.length+'f'](location,...args);};
 function resize(){const r=canvas.getBoundingClientRect();canvas.width=Math.max(1,Math.round(Math.min(r.width,850)));canvas.height=Math.max(1,Math.round(canvas.width/(r.width/Math.max(1,r.height))));gl.viewport(0,0,canvas.width,canvas.height);uniform('uResolution',canvas.width,canvas.height);repaint();}
 const observer=new ResizeObserver(resize);observer.observe(canvas);cleanups.push(()=>{observer.disconnect();gl.deleteBuffer(buffer);gl.deleteProgram(program);gl.deleteShader(vs);gl.deleteShader(fs);});resize();return {gl,program,buffer,uniform,resize};}
try{
if(!window.THREE)throw Error('The bundled Three.js dependency did not initialize.');
const canvas=$('[data-three-canvas]');
let renderer;try{renderer=new THREE.WebGLRenderer({canvas,alpha:true,antialias:true,preserveDrawingBuffer:true});}catch(error){canvas.hidden=true;$('[data-context-fallback]').hidden=false;throw error;}
renderer.outputColorSpace=THREE.SRGBColorSpace;
renderer.setClearColor(0x071e22,0);
cleanups.push(()=>{renderer.renderLists.dispose();renderer.dispose();});

const scene=new THREE.Scene(),camera=new THREE.PerspectiveCamera(50,1,.1,40);
camera.position.set(0,0,5);camera.lookAt(0,0,0);camera.updateMatrixWorld();
scene.add(new THREE.HemisphereLight(0xc6fff2,0x152a35,2));
const light=new THREE.DirectionalLight(0xffdcb3,3);light.position.set(-2,4,7);scene.add(light);
const geometry=new THREE.BufferGeometry(),position=new THREE.BufferAttribute(new Float32Array(63*3),3).setUsage(THREE.DynamicDrawUsage),colors=[],indices=[];
for(let row=0;row<7;row++)for(let column=0;column<9;column++){const color=new THREE.Color().setHSL(.13+column/8*.34,.62,.48+row/6*.1);colors.push(color.r,color.g,color.b);if(row<6&&column<8){const a=row*9+column;indices.push(a,a+9,a+1,a+1,a+9,a+10);}}
geometry.setAttribute('position',position);geometry.setAttribute('color',new THREE.Float32BufferAttribute(colors,3));geometry.setIndex(indices);
const material=new THREE.MeshStandardMaterial({vertexColors:true,roughness:.5,metalness:.15,side:THREE.DoubleSide}),mesh=new THREE.Mesh(geometry,material);mesh.frustumCulled=false;scene.add(mesh);
const projected=new THREE.Vector3(),overlay=$('[data-projection-overlay]'),frame=$('[data-projection-frame]');
let inputPhase=.55,inputUpdates=0,renderCount=0,positionUploads=0,lastGeometryKey='',inputKey='',points=[],viewWidth=1,viewHeight=1;
function generatedPatch(phase,u,v){const points=[];for(let row=0;row<7;row++)for(let column=0;column<9;column++){const x=(column-4)/4,y=(row-3)/3,edge=1-.15*Math.abs(y),wave=Math.sin(column*.65+phase)*Math.cos(row*.5-phase*.7);points.push({u:.5+x*.32*edge+.018*Math.sin(row+phase),v:.5+y*.33+.018*Math.sin(column*.8-phase),w:.08+.10*wave+.045*Math.sin(x*3+y)});}points[12].u=u;points[12].v=v;return points;}
function coverReference(point,inputAspect,width,height,mirrored){const inputWidth=1000*inputAspect,inputHeight=1000,fit=Math.max(width/inputWidth,height/inputHeight),contentWidth=inputWidth*fit,contentHeight=inputHeight*fit;const x=point.u*contentWidth+(width-contentWidth)/2;return {x:mirrored?width-x:x,y:point.v*contentHeight+(height-contentHeight)/2};}
function mapGeneratedVertex(point,inputAspect,viewAspect,depthScale,mirrored,compensated){const distance=5,planeHeight=2*Math.tan(50*Math.PI/360)*distance,planeWidth=planeHeight*viewAspect,scaleX=viewAspect>inputAspect?planeWidth:planeHeight*inputAspect,scaleY=viewAspect>inputAspect?planeWidth/inputAspect:planeHeight;const z=-point.w*scaleX*depthScale,rayScale=compensated?(distance-z)/distance:1;return [(mirrored?.5-point.u:point.u-.5)*scaleX*rayScale,(.5-point.v)*scaleY*rayScale,z];}
function renderProjection(dt){if(document.hidden)return;if(dt)inputPhase+=dt*.75;const inputState=[inputPhase,number('sampleU'),number('sampleV')].join('|');if(inputState!==inputKey){points=generatedPatch(inputPhase,number('sampleU'),number('sampleV'));inputKey=inputState;inputUpdates++;}frame.style.setProperty('--projection-aspect',value('frameAspect'));const bounds=canvas.getBoundingClientRect(),width=Math.max(1,bounds.width),height=Math.max(1,bounds.height);if(width!==viewWidth||height!==viewHeight){viewWidth=width;viewHeight=height;renderer.setPixelRatio(Math.min(devicePixelRatio||1,2));renderer.setSize(width,height,false);camera.aspect=width/height;camera.updateProjectionMatrix();}
const mirrored=value('mirror')==='yes',compensated=value('compensate')==='on',geometryKey=[inputKey,width,height,value('inputAspect'),value('depth'),mirrored,compensated].join('|');if(geometryKey!==lastGeometryKey){points.forEach((point,i)=>position.setXYZ(i,...mapGeneratedVertex(point,number('inputAspect'),width/height,number('depth'),mirrored,compensated)));position.needsUpdate=true;geometry.computeVertexNormals();lastGeometryKey=geometryKey;positionUploads++;}
material.wireframe=value('surface')==='wire';renderer.render(scene,camera);renderCount++;mesh.updateMatrixWorld();camera.updateMatrixWorld();let squareError=0;const markers=[];for(let i=0;i<points.length;i++){projected.fromBufferAttribute(position,i).applyMatrix4(mesh.matrixWorld).project(camera);const px=(projected.x+1)*width/2,py=(1-projected.y)*height/2,target=coverReference(points[i],number('inputAspect'),width,height,mirrored);squareError+=(px-target.x)**2+(py-target.y)**2;markers.push('<path d="M '+target.x+' '+target.y+' L '+px+' '+py+'" stroke="#ffb19e" stroke-width="1"/><circle cx="'+target.x+'" cy="'+target.y+'" r="'+(i===12?6:2.5)+'" fill="none" stroke="#fff2c6" stroke-width="1"/><circle cx="'+px+'" cy="'+py+'" r="'+(i===12?3.5:1.5)+'" fill="#65f2d2"/>');}overlay.setAttribute('viewBox','0 0 '+width+' '+height);overlay.innerHTML=markers.join('');const rms=Math.sqrt(squareError/points.length);setText('[data-drift]',rms.toFixed(3)+' CSS px');setText('[data-sample]',points[12].u.toFixed(2)+', '+points[12].v.toFixed(2)+', '+points[12].w.toFixed(3));setText('[data-readout]','INPUT / GENERATED · '+inputUpdates+' UPDATES\nRENDERS / '+renderCount+'\nPOSITION UPDATES / '+positionUploads+'\nBUFFER / SAME 189 FLOATS\nCAMERA / FOV 50° · DISTANCE 5\nDRIFT / ALL 63 VERTICES');}
listen('step-input',()=>{stop();inputPhase+=.12;repaint();});listen('redraw',repaint);listen('reset',()=>{stop();inputPhase=.55;const defaults={sampleU:.29,sampleV:.30,depth:.8,inputAspect:'1.3333333333',frameAspect:'1.4',mirror:'yes',compensate:'off',surface:'lit'};for(const [key,v]of Object.entries(defaults)){$('[data-control="'+key+'"]').value=String(v);setText('[data-value="'+key+'"]',v);}repaint();});
const resizeObserver=new ResizeObserver(repaint);resizeObserver.observe(frame);cleanups.push(()=>{resizeObserver.disconnect();geometry.dispose();material.dispose();});install(renderProjection);
}catch(error){report(error);}
requestAnimationFrame(()=>requestAnimationFrame(()=>{if(preview.status!=='error'){preview.status='mounted';document.body.dataset.previewStatus='mounted';parent.postMessage({type:'sg-preview-ready',id},'*');observe();setTimeout(observe,700);}}));
})();
LICENSE독립 구현
파일 저장

MIT License

Copyright (c) 2026 StyleGallery contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Scope: independently authored study HTML, CSS, JavaScript, shaders and SVG only. Original articles, source projects, brands, artwork and screenshots are excluded. Their licenses and acquisition dispositions are unchanged.


Bundled dependency: Three.js 0.160.0. The following notice applies to its unmodified library, embedded in index.html.

The MIT License

Copyright © 2010-2023 three.js authors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
NOTES.md독립 구현
파일 저장

# Depth without drift.

Independent article case study. Domain: website consumer / Design Engineering presentation.

An original indexed patch reuses a persistent position buffer. Normalized generated coordinates map through cover sizing and optional camera-ray compensation into a Three.js perspective camera. Actual updated vertex positions are projected with that camera and compared in CSS pixels with an independently calculated 2D cover reference. No camera or face inference is used.

## Attribution and evidence

Studied: [Building a Real-Time 3D Face Mask with MediaPipe, Threlte and Three.js](https://tympanus.net/codrops/2026/09/06/building-a-real-time-3d-face-mask-with-mediapipe-threlte-and-three-js/), Marek Jóźwiak. Article SHA-256: 1fc57bdd832d848252228ebcf9f875bba47b9cc3d66c0920ae24fb906c7f57f7. Analysis SHA-256: 47f3b42b8d2834808f51416ec9dbb69603b13e45d719398308a94b1bbcbc1c1d. Source revision: 3685a062df84de6c12b5583670a4be1e17226b66439c7ee42daf895d335d8600. The revision hashes the article/analysis hashes, the analyst principle and code-block evidence references, plus pinned original source/line hashes and the implementation contract; it identifies studied evidence, not a claim that the original demo executes.

Original acquisition: acquired. Original license: MIT. originalSourceAcquired: true. Source code acquisition is complete. Original runtime remains unresolved: The Svelte/MediaPipe implementation requires a live camera, model/WASM downloads, and browser media permission. The current opaque allow-scripts preview contract does not provide camera access; this is an execution prerequisite, not a paid exclusion.

No original article prose, code, artwork, source project or screenshot is distributed here. The authored-code MIT notice applies only to the independent implementation. Three.js 0.160.0 is an unmodified third-party dependency embedded in index.html; its own MIT notice is included in LICENSE and the inline dependency header. Dependency SHA-256: 170c6789f43217c96b3170f4b42fafe135de7f7cd48497a4218f9757ee1d49fa. No dependency request occurs at runtime. The original source remains acquired/MIT, while its live camera and model prerequisites remain unresolved under the original opaque preview contract. All 63 points and 96 triangles are independently generated; there is no camera request, detector, canonical face topology, face texture or physical-depth estimate. RMS drift is computed for all vertices, including any cropped offscreen; it measures this coordinate mapping, not face-tracking accuracy.

## Initial state and controls

This is a generated membrane, built from 63 editable coordinates. Follow its points through cover cropping, mirroring and depth, then compare the projected mesh with a separate 2D reference.

The page starts stationary. Play motion, where present, advances this study’s presentation until paused; text, bounce, portrait, orbit, strand and mascot motion loops, while the event composer stops at its endpoint. Scroll studies advance through ordinary document scroll or their chapter buttons. Static view stops time-based motion; manual controls still inspect values. The three scroll studies instead show every chapter in ordinary reading flow. Pointer parallax centers its decorative layers. In this projection study, Play motion advances generated input. Step input pauses and advances that input once; Redraw only renders without changing input. Initial compensation is off to make depth drift visible.

Initial control values:

| Control key | Value |
| --- | --- |
| inputAspect | 1.3333333333 |
| frameAspect | 1.4 |
| mirror | yes |
| depth | 0.8 |
| compensate | off |
| surface | lit |
| sampleU | 0.29 |
| sampleV | 0.3 |

## Running and editing

Open index.html directly. It contains all runtime code and visuals and needs no package install, account, network, remote asset or browser-origin storage. Edit its inline style and script to change the downloaded page. styles.css and script.js are reference copies of the inline source; changing those copies alone does not change the running page. Repository regeneration overwrites index.html and all generated copies, including any manual edits. Keep a separate copy when editing a download. The repository authoring modules in vendor/codrops-article-studies/scenes-*.mjs and runtime.mjs regenerate these copies through node scripts/build-codrops-article-studies.mjs. Repository regeneration also needs the private source evidence; downloaded-page execution does not.

## Verification boundary

This generation passed the captured article/analysis hash checks, article-code/paragraph pointer hashes, pinned source/line hashes, record/license/receipt hashes and original runtime snapshot hash, exact ID membership, local canonical Markdown anchor/hash checks, implementation-symbol checks, JavaScript parsing, semantic main/title counts, duplicate-ID checks and runtime URL/storage exclusion. The manifest codeFiles entries identify every emitted file by SHA-256. Each code symbol is a searchable named function, not a claimed executed call trace. Proposed checks are in KNOWLEDGE.json. runtime_verified: false. SG artifact capture proves only a recorded initial render; no interactive runtime, keyboard, accessibility, comfort or performance result is claimed.

Manual Chrome interaction is blocked by extension UI in this session. No alternate browser-control route was used. Preview sizing is native responsive width. Initial-render captures are tracked separately at site/artifacts/full-import/preview-posters/index.json and site/artifacts/full-import/preview-posters/visual-review.json in the repository. No capture receipt is bundled with this download. The bounded initial-render matrix requests all 21 studies at 320 pixels and three representative studies at 1280 pixels; the separate poster surface is 640 × 420. The authored CSS also adapts at 375 and 768 pixels, without claiming those widths were captured. A width request does not mean that capture exists or passed. Motion starts on explicit playback; system reduced motion and the Static view switch stop it.

consumer_reference: consumer-reference/agent-native/registry.json
KNOWLEDGE.json독립 구현
파일 저장

[
  {
    "id": "codrops-2037f8fa6eb9-article-0",
    "source": "design-engineering/state-management/patterns/derived-state.md",
    "anchor": "state-model-and-ownership",
    "sourceSha256": "22192b2fbab970a71ec0237221dc2d35c578e59723bc0032c2347f8ef595cd6c",
    "title": "20 / Generated coordinates & camera projection · mapGeneratedVertex",
    "principle": "A single generated input set and explicit mapping controls determine the current 3D coordinates; projected errors are derived from the actual buffer and camera.",
    "application": "An original indexed patch reuses a persistent position buffer. Normalized generated coordinates map through cover sizing and optional camera-ray compensation into a Three.js perspective camera. Actual updated vertex positions are projected with that camera and compared in CSS pixels with an independently calculated 2D cover reference. No camera or face inference is used. This binding describes the authored study and does not verify the original project.",
    "code": [
      {
        "file": "vendor/codrops-article-studies/records/codrops-2037f8fa6eb9/script.js",
        "symbol": "mapGeneratedVertex",
        "explanation": "The named local function implements this mechanism in the downloadable standalone page; its source hash is listed in codeFiles."
      }
    ],
    "checks": [
      {
        "id": "codrops-2037f8fa6eb9-mapGeneratedVertex",
        "action": "Pause generated motion; compare compensation off/on at nonzero depth, then vary input aspect and mirroring.",
        "expected": "The actual camera projection aligns with the separate 2D cover reference when compensated; disabling compensation exposes perspective drift."
      }
    ],
    "runtime_verified": false
  },
  {
    "id": "codrops-2037f8fa6eb9-article-1",
    "source": "motion/rendering-and-performance.md",
    "anchor": "a-diagnostic-sequence",
    "sourceSha256": "1523fdeaa290fa064c4db17d36040de3f35ad39bb18a37517ceb5995f97d1dfd",
    "title": "20 / Generated coordinates & camera projection · renderProjection",
    "principle": "Input generation, position uploads and completed renders have distinct counters so a redraw can be distinguished from a new input sample.",
    "application": "An original indexed patch reuses a persistent position buffer. Normalized generated coordinates map through cover sizing and optional camera-ray compensation into a Three.js perspective camera. Actual updated vertex positions are projected with that camera and compared in CSS pixels with an independently calculated 2D cover reference. No camera or face inference is used. This binding describes the authored study and does not verify the original project.",
    "code": [
      {
        "file": "vendor/codrops-article-studies/records/codrops-2037f8fa6eb9/script.js",
        "symbol": "renderProjection",
        "explanation": "The named local function implements this mechanism in the downloadable standalone page; its source hash is listed in codeFiles."
      }
    ],
    "checks": [
      {
        "id": "codrops-2037f8fa6eb9-renderProjection",
        "action": "Press Redraw only, Step input, then change the surface between lit and wireframe.",
        "expected": "Redraw increments only the render counter; Step input also updates generated input and positions; surface changes preserve the input and position buffer."
      }
    ],
    "runtime_verified": false
  },
  {
    "id": "codrops-2037f8fa6eb9-article-2",
    "source": "motion/accessible-motion.md",
    "anchor": "preference-changes-during-work",
    "sourceSha256": "db0ad692d5bb3103a3cbe13ec08dbe5cf12552aed7ecf2c93b1d7cc0b8a34b8b",
    "title": "20 / Generated coordinates & camera projection · applyMotionPreference",
    "principle": "One effective preference owns CSS and script playback. The initial view is stationary, and manual controls retain the study values.",
    "application": "An original indexed patch reuses a persistent position buffer. Normalized generated coordinates map through cover sizing and optional camera-ray compensation into a Three.js perspective camera. Actual updated vertex positions are projected with that camera and compared in CSS pixels with an independently calculated 2D cover reference. No camera or face inference is used. This binding describes the authored study and does not verify the original project.",
    "code": [
      {
        "file": "vendor/codrops-article-studies/records/codrops-2037f8fa6eb9/script.js",
        "symbol": "applyMotionPreference",
        "explanation": "The named local function implements this mechanism in the downloadable standalone page; its source hash is listed in codeFiles."
      }
    ],
    "checks": [
      {
        "id": "codrops-2037f8fa6eb9-applyMotionPreference",
        "action": "Enable Static view during playback, then adjust the visible native controls.",
        "expected": "Playback stops, its button is disabled while the preference applies, and the current values remain inspectable without continuous motion."
      }
    ],
    "runtime_verified": false
  }
]
RETRIEVAL-LOG.md독립 구현
파일 저장

# Retrieval log

Understood as: preserve all 21 original catalog IDs and acquisition dispositions while independently implementing each article’s technical principle as a consumer-owned case study.

SG discover and workflow read from site-compiler revision 6deb1970c80ed113b90be8d6ca617616bbe336c4; workflow SHA-256 0318a99707293af423e52b99b40cf1d87d9c7725e3ab06c5a231e3946f2bebb9. Stage 3 handoff is the primary implementation brief. No original scene assets or source files are reused.

Read-only canonical traversal:
1. AGENTS.md
2. README.md
3. DOMAINS.md
4. GOVERNANCE.md
5. design-engineering/index.md
6. motion/index.md
7. design-engineering/component-contract.md
8. design-engineering/state-management/patterns/derived-state.md
9. design-engineering/native-interaction-contracts.md
10. motion/accessible-motion.md
11. motion/rendering-and-performance.md
12. motion/interruption-and-retargeting.md
13. motion/interaction-recipes.md

Applied canonical sections and current-authoring hashes are recorded in KNOWLEDGE.json. No design-terminology records are relied on. External references within canonical guidance were not independently rechecked by this implementation lane; only the local sections and article capture identities were checked. Root Layout corpus, Game UI, provider integrations and publisher export claims were rejected as outside this lane.