3D Unboxing Package
A cardboard box in true 3D that slices its tape, unfolds its flaps and lifts out a packing slip.
Preview and code
index.html
<!--
MIT License
Copyright (c) 2026 Suraj Maurya
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.
-->
<div class="pk-stage">
<div class="pk" style="--box:#b07b4a;--tape:#d3c3aa;--paper:#fbfaf6;--ink:#1c1a17;--accent:#c2552b">
<div class="pk-h"><div class="pk-sc"><div class="pk-hov"><div class="pk-persp"><div class="pk-scene">
<div class="pk-shadow" aria-hidden="true"></div>
<div class="pk-box" aria-hidden="true">
<div class="pk-wall" style="transform:rotateX(-90deg) translateZ(100px)"><div class="pk-o pk-floor"></div><div class="pk-i pk-floor"></div></div>
<div class="pk-wall" style="transform:rotateY(180deg) translateZ(100px)"><div class="pk-o pk-fl"></div><div class="pk-i"></div><div class="pk-flap" data-f="mb"><div class="pk-u"></div><div class="pk-t"><b class="pk-tp pk-th"></b></div></div></div>
<div class="pk-wall" style="transform:rotateY(-90deg) translateZ(100px)"><div class="pk-o pk-fr"><div class="pk-tail pk-tp"><span></span></div></div><div class="pk-i"></div><div class="pk-flap minor" data-f="nl"><div class="pk-u"></div><div class="pk-t"></div></div></div>
<div class="pk-wall" style="transform:translateZ(100px)"><div class="pk-o pk-fl pk-front"><div class="pk-stk"><i></i><div class="pk-sr"><em></em><span><s></s><s style="width:80%"></s><s></s><s style="width:60%"></s></span></div><u></u></div></div><div class="pk-i"></div><div class="pk-flap" data-f="mf"><div class="pk-u"></div><div class="pk-t"><b class="pk-tp pk-th"></b></div></div></div>
<div class="pk-wall" style="transform:rotateY(90deg) translateZ(100px)"><div class="pk-o pk-fr pk-side"><div class="pk-tail pk-tp"><span></span></div><svg class="pk-sym" viewBox="0 0 100 64"><path d="M8 6h38c0 15-8 23-19 23S8 21 8 6Z" fill="currentColor"/><path d="M17 6l5 8-6 5 6 6" fill="none" stroke="color-mix(in srgb,var(--box),black 26%)" stroke-width="2.2" stroke-linejoin="round"/><path d="M27 29v22M15 53h24" stroke="currentColor" stroke-width="3" stroke-linecap="round"/><g fill="currentColor"><rect x="66" y="22" width="5" height="28" rx="1"/><path d="M68.5 8l8 15h-16Z"/><rect x="84" y="22" width="5" height="28" rx="1"/><path d="M86.5 8l8 15h-16Z"/></g><path d="M62 56h36" stroke="currentColor" stroke-width="2.6" stroke-linecap="round"/></svg></div><div class="pk-i"></div><div class="pk-flap minor" data-f="nr"><div class="pk-u"></div><div class="pk-t"></div></div></div>
</div>
<div class="pk-paper" id="pk-doc" role="document" aria-label="Packing slip" aria-hidden="true">
<div class="pk-slip">
<div class="pk-ey"><span>Packing slip</span><span class="mono">№ 4821</span></div>
<h3>Thank you, Ana.</h3><p class="pk-soft pk-sub">Your order is packed and on its way.</p>
<div class="pk-rule"></div>
<div class="pk-ad"><div><p class="pk-soft">Ship to</p><p class="b">Ana Rivera</p><p class="pk-soft">24 Linden Street, Lisbon</p></div><div class="r"><p class="pk-soft">Date</p><p class="b">Nov 19, 2026</p></div></div>
<div class="pk-rule"></div>
<ul><li><span>Oak desk lamp</span><span>$89.00</span></li><li><span>2× Linen pouch</span><span>$36.00</span></li><li><span>Dotted notebook</span><span>$14.00</span></li></ul>
<div class="pk-tot"><span>Total</span><b>$139.00</b></div>
<div class="pk-ft"><svg viewBox="0 0 70 26" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 20c7-14 12-17 14-8s-5 13 0 11 9-17 14-13-3 11 2 9 9-9 14-7 6 6 11 2"/></svg><span class="pk-stamp">Packed</span></div>
</div>
</div>
</div></div></div></div></div>
<div class="pk-ctl"><button type="button" class="pk-btn" aria-expanded="false" aria-controls="pk-doc">Click to open</button></div>
</div>
</div>
styles.css
.pk-stage{width:100%;height:calc(100vh - 40px);min-height:300px;display:grid;grid-template-columns:minmax(0,1fr);place-items:center;overflow:hidden;padding:12px;border-radius:16px;background:#f4f3f0;font-family:Inter,system-ui,-apple-system,"Segoe UI",sans-serif}
.pk{width:min(460px,100%);opacity:0;transition:opacity .2s}
.pk.ready{opacity:1}
.pk-h{position:relative;width:100%;overflow:visible}
.pk-sc{position:absolute;left:50%;bottom:0;width:440px;height:650px;transform-origin:50% 100%;pointer-events:none}
.pk-hov{position:absolute;inset:0;transition:transform .35s cubic-bezier(.3,1.3,.5,1)}
.pk.hov:not(.open) .pk-hov{transform:translateY(-4px)}
.pk-persp{position:absolute;inset:0;perspective:2200px;perspective-origin:50% 38%}
.pk-scene{position:absolute;left:120px;top:353px;width:200px;height:200px;transform:rotateX(-30deg) rotateY(-45deg);transform-style:preserve-3d}
.pk-shadow{position:absolute;left:-70px;top:-70px;width:340px;height:340px;background:radial-gradient(closest-side,rgba(45,28,10,.34),rgba(45,28,10,.14) 58%,transparent);transform:rotateX(90deg) translateZ(-103px)}
.pk-box,.pk-wall{position:absolute;inset:0;transform-style:preserve-3d}
.pk-o,.pk-i,.pk-u,.pk-t{position:absolute;inset:0;border-radius:5px;-webkit-backface-visibility:hidden;backface-visibility:hidden;pointer-events:auto;cursor:pointer}
.pk-i{background:linear-gradient(180deg,color-mix(in srgb,var(--box),black 42%),color-mix(in srgb,var(--box),black 72%));transform:rotateY(180deg)}
.pk-floor{background:color-mix(in srgb,var(--box),black 80%)}
.pk-g{}
.pk-fl,.pk-fr,.pk-t{background-blend-mode:normal}
.pk-fl{background:var(--grain),linear-gradient(165deg,color-mix(in srgb,var(--box),white 6%),color-mix(in srgb,var(--box),black 7%))}
.pk-fr{background:var(--grain),linear-gradient(165deg,color-mix(in srgb,var(--box),black 26%),color-mix(in srgb,var(--box),black 36%))}
.pk-front{box-shadow:inset -12px 0 20px -12px rgba(60,30,5,.3),inset 0 10px 14px -10px rgba(255,255,255,.2)}
.pk-side{box-shadow:inset 12px 0 20px -12px rgba(30,15,0,.35),inset 0 10px 14px -10px rgba(255,255,255,.1)}
.pk-flap{position:absolute;left:0;top:0;width:200px;height:100px;transform-origin:50% 0;transform:rotateX(-90deg);transform-style:preserve-3d}
.pk-flap.minor{top:1.5px}
.pk-u{border-radius:0 0 4px 4px;background:linear-gradient(180deg,color-mix(in srgb,var(--box),black 36%),color-mix(in srgb,var(--box),black 50%))}
.pk-t{border-radius:0 0 4px 4px;background:var(--grain),linear-gradient(135deg,color-mix(in srgb,var(--box),white 14%),color-mix(in srgb,var(--box),white 3%));transform:rotateY(180deg);box-shadow:inset 0 -1px 0 rgba(60,30,5,.28)}
.pk-tp{background:linear-gradient(180deg,color-mix(in srgb,var(--tape),white 18%),var(--tape) 55%,color-mix(in srgb,var(--tape),black 8%));box-shadow:0 0 0 .5px rgba(80,50,20,.18)}
.pk-th{position:absolute;left:0;right:0;bottom:0;height:23px}
.pk-tail{position:absolute;left:calc(50% - 23px);top:0;width:46px;height:60px;border-radius:0 0 2px 2px}
.pk-tail span{position:absolute;left:50%;top:0;bottom:0;width:1px;background:rgba(70,40,15,.5);opacity:0}
.pk-stk{position:absolute;left:58%;top:20%;width:33%;height:38%;padding:5%;border-radius:2px;background:#f6f4ef;box-shadow:0 1px 2px rgba(40,20,5,.35)}
.pk-stk i{display:block;width:70%;height:8%;border-radius:1px;background:rgba(64,64,64,.8)}
.pk-sr{display:flex;gap:8%;height:52%;margin-top:7%}
.pk-sr em{width:46%;background:repeating-linear-gradient(90deg,#26231f 0 1px,transparent 1px 2px,#26231f 2px 4px,transparent 4px 5px)}
.pk-sr span{display:flex;flex:1;flex-direction:column;justify-content:space-between;padding:3% 0}
.pk-sr s{display:block;width:100%;height:10%;border-radius:1px;background:rgba(163,163,163,.8);text-decoration:none}
.pk-stk u{display:block;width:100%;height:14%;margin-top:6%;border-radius:1px;background:rgba(212,212,212,.9);text-decoration:none}
.pk-sym{position:absolute;left:36%;top:58%;width:58%;height:32%;color:color-mix(in srgb,var(--box),#24130a 72%);opacity:.85}
.pk-paper{position:absolute;left:-20px;top:-70px;width:240px;height:340px;overflow:hidden;border-radius:3px;background:linear-gradient(180deg,transparent 33%,rgba(0,0,0,.035) 33.3%,transparent 34%,transparent 66.3%,rgba(0,0,0,.035) 66.6%,transparent 67.3%),radial-gradient(120% 80% at 20% 0%,rgba(255,255,255,.7),transparent 60%),var(--paper);color:var(--ink);-webkit-backface-visibility:hidden;backface-visibility:hidden;pointer-events:none;box-shadow:0 1px 0 rgba(0,0,0,.05),0 14px 28px -10px rgba(40,25,10,.35),0 2px 6px rgba(40,25,10,.12);-webkit-font-smoothing:antialiased}
.pk.open .pk-paper{pointer-events:auto;cursor:default}
.pk-slip{display:flex;flex-direction:column;height:100%;padding:24px 24px 20px}
.pk-soft{color:color-mix(in srgb,var(--ink) 52%,transparent)}
.pk-ey{display:flex;align-items:center;justify-content:space-between;color:color-mix(in srgb,var(--ink) 52%,transparent);font-size:8.5px;font-weight:500;letter-spacing:.18em;text-transform:uppercase}
.pk-ey .mono{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;letter-spacing:0}
.pk-slip h3{margin:16px 0 0;font:400 22px/1.08 Georgia,"Times New Roman",serif;letter-spacing:-.02em}
.pk-sub{margin:6px 0 0;font-size:10.5px;line-height:1.35}
.pk-rule{margin:12px 0;border-top:1px solid color-mix(in srgb,var(--ink) 14%,transparent)}
.pk-ad{display:grid;grid-template-columns:1fr auto;gap:0 16px;font-size:10px;line-height:1.35}
.pk-ad p{margin:0}.pk-ad .b{margin-top:2px;font-weight:500}.pk-ad .r{text-align:right}
.pk-slip ul{display:flex;flex-direction:column;gap:6px;margin:0;padding:0;font-size:10.5px;list-style:none}
.pk-slip li{display:flex;align-items:baseline;justify-content:space-between;gap:12px}
.pk-slip li span:last-child{flex:none;font-variant-numeric:tabular-nums}
.pk-tot{display:flex;align-items:baseline;justify-content:space-between;margin-top:12px;padding-top:10px;border-top:1px solid color-mix(in srgb,var(--ink) 14%,transparent)}
.pk-tot span{color:color-mix(in srgb,var(--ink) 52%,transparent);font-size:8.5px;font-weight:500;letter-spacing:.18em;text-transform:uppercase}
.pk-tot b{font:400 18px/1 Georgia,"Times New Roman",serif;letter-spacing:-.02em}
.pk-ft{display:flex;align-items:flex-end;justify-content:space-between;margin-top:auto}
.pk-ft svg{width:68px;height:24px;opacity:.7}
.pk-stamp{display:grid;place-items:center;width:46px;height:46px;border:1.5px solid var(--accent);border-radius:50%;color:var(--accent);font-size:7.5px;font-weight:600;letter-spacing:.16em;text-transform:uppercase;opacity:.85;mix-blend-mode:multiply;transform:rotate(-10deg)}
.pk-ctl{display:flex;justify-content:center;margin-top:4px}
.pk-btn{display:inline-flex;align-items:center;height:36px;padding:0 16px;border:0;border-radius:999px;background:none;color:#737373;font:inherit;font-size:12.5px;font-weight:500;cursor:pointer;-webkit-tap-highlight-color:transparent;transition:color .15s,background .15s,transform .15s}
.pk-btn:active{transform:scale(.97)}
.pk-btn:focus-visible{outline:2px solid #a3a3a3}
@media (hover:hover){.pk-btn:hover{background:rgba(0,0,0,.04);color:#262626}}
@media (prefers-reduced-motion:reduce){.pk-hov,.pk{transition:none}}
script.js
(function(){
var GRAIN="url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .3 0 0 0 0 .17 0 0 0 0 .06 0 0 0 .5 -.1'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>\")";
function bez(x1,y1,x2,y2){function a(p1,p2){return 1-3*p2+3*p1;}function b(p1,p2){return 3*p2-6*p1;}function c(p1){return 3*p1;}function f(t,p1,p2){return((a(p1,p2)*t+b(p1,p2))*t+c(p1))*t;}function d(t,p1,p2){return 3*a(p1,p2)*t*t+2*b(p1,p2)*t+c(p1);}
return function(x){if(x<=0)return 0;if(x>=1)return 1;var t=x;for(var i=0;i<8;i++){var e=f(t,x1,x2)-x,s=d(t,x1,x2);if(Math.abs(e)<1e-5)break;if(Math.abs(s)<1e-6)break;t-=e/s;}return f(t,y1,y2);};}
var EF=bez(.34,1.1,.5,1),ER=bez(.22,.8,.2,1),ES=bez(.3,.9,.3,1),rad=function(d){return d*Math.PI/180;},TILT=-30,TURN=-45;
function rx(v,a){return[v[0],v[1]*Math.cos(a)-v[2]*Math.sin(a),v[1]*Math.sin(a)+v[2]*Math.cos(a)];}
function ry(v,a){return[v[0]*Math.cos(a)+v[2]*Math.sin(a),v[1],-v[0]*Math.sin(a)+v[2]*Math.cos(a)];}
var FW=ry(rx([0,0,1],rad(-TILT)),rad(-TURN));
function seg(t,a,b,ease){var k=(t-a)/(b-a);k=Math.max(0,Math.min(1,k));return ease?ease(k):k;}
function pose(r,s){var sc=.54+.46*s,bottom=96-208*r-14*s,cy=bottom-340*sc/2,d=56*s;return 'translate3d('+(FW[0]*d).toFixed(2)+'px,'+(cy+FW[1]*d).toFixed(2)+'px,'+(FW[2]*d).toFixed(2)+'px) rotateY('+(-TURN*s).toFixed(2)+'deg) rotateX('+(-TILT*s).toFixed(2)+'deg) scale('+sc.toFixed(4)+')';}
var reduce=matchMedia('(prefers-reduced-motion: reduce)').matches;
document.querySelectorAll('.pk').forEach(function(root){
root.style.setProperty('--grain',GRAIN);
var h=root.querySelector('.pk-h'),sc=root.querySelector('.pk-sc'),stage=root.parentNode,paper=root.querySelector('.pk-paper'),btn=root.querySelector('.pk-btn'),fl={},tails=root.querySelectorAll('.pk-tail span'),ths=root.querySelectorAll('.pk-th'),t=0,open=false,raf=null,scale=1;
root.querySelectorAll('.pk-flap').forEach(function(f){fl[f.dataset.f]=f;});
function lin(t,a,b,from,to,ease){var k=(t-a)/(b-a);if(!ease)k=Math.max(0,Math.min(1,k));else k=ease(Math.max(0,Math.min(1,k)));return from+(to-from)*k;}
function paint(){var cut=seg(t,0,.08);fl.mf.style.transform='rotateX('+lin(t,.08,.34,-90,-238,EF)+'deg)';fl.mb.style.transform='rotateX('+lin(t,.11,.37,-90,-238,EF)+'deg)';fl.nr.style.transform='rotateX('+lin(t,.26,.5,-90,-212,EF)+'deg)';fl.nl.style.transform='rotateX('+lin(t,.29,.53,-90,-212,EF)+'deg)';
tails.forEach(function(s){s.style.opacity=cut;});ths.forEach(function(s){s.style.height=(23-.9*cut)+'px';});
var r=seg(t,.46,.78,ER),s=seg(t,.66,1,ES);paper.style.transform=pose(r,s);var g=.65*r+.35*s;h.style.height=((392+258*g)*scale)+'px';}
function fit(){var w=root.clientWidth||440,avail=(stage.clientHeight||650)-24-44;scale=Math.max(.3,Math.min(w/440,avail/650,1.05));sc.style.transform='translateX(-50%) scale('+scale+')';paint();root.classList.add('ready');}
function run(){cancelAnimationFrame(raf);if(reduce){t=open?1:0;paint();return;}var from=t,to=open?1:0,dur=(open?2.4:1.5)*Math.abs(to-from)*1000,t0=performance.now();raf=requestAnimationFrame(function f(now){var k=dur?Math.min(1,(now-t0)/dur):1;t=from+(to-from)*k;paint();if(k<1)raf=requestAnimationFrame(f);});}
function toggle(){open=!open;root.classList.toggle('open',open);btn.textContent=open?'Close':'Click to open';btn.setAttribute('aria-expanded',open);paper.setAttribute('aria-hidden',!open);run();}
root.querySelector('.pk-box').addEventListener('click',toggle);btn.addEventListener('click',toggle);
root.querySelectorAll('.pk-box .pk-o,.pk-box .pk-t,.pk-box .pk-u').forEach(function(el){el.addEventListener('mouseenter',function(){root.classList.add('hov');});el.addEventListener('mouseleave',function(){root.classList.remove('hov');});});
paper.addEventListener('click',function(e){e.stopPropagation();});
document.addEventListener('keydown',function(e){if(e.key==='Escape'&&open)toggle();});
fit();if(window.ResizeObserver)new ResizeObserver(fit).observe(stage);else addEventListener('resize',fit);
});
})();
About
An unboxing moment built entirely from CSS 3D. A grainy kraft box sits at an angle with a shipping sticker, fragile and this-side-up marks and a strip of packing tape. Click it and the tape is sliced, the two long flaps swing open one after the other, the short flaps follow, and a cream packing slip rises out of the box, turns to face you and grows to full size, showing a thank-you note, the address, items, total, a signature and a red Packed stamp. Click again or press Escape and it all reverses into the box. It scales to any width and has a keyboard button below.


