Macro Focus Plane
A ladybird on a leaf: slide the focus plane and change aperture to see how thin macro focus is.
AI prompt
Macro photograph of a red ladybird walking along a green leaf edge, the eyes and antennae razor sharp, the rest of the body softly fading out of focus, foreground blades of grass as a creamy blurred green streak at the lower left, a distant blurred background of warm yellow bokeh, dew drops on the leaf, 100mm macro lens at f/4, natural morning light, delicate and detailed. Variants: f/16 with the whole insect sharp, and focus moved to the foreground grass. Negative: motion blur, noise, harsh flash, text, watermark. Reduced motion: static image.About this pattern
Definition
In macro photography the subject is very close to the lens, which makes the depth of field extremely thin: a few millimetres can separate sharp from blurry. Moving focus slightly changes what is sharp, and narrowing the aperture gains depth at the cost of light.
When to use it
- Focus plane: the one distance that is perfectly sharp; things in front and behind blur gradually.
- Wide aperture such as f/2.8 gives a creamy background and a razor-thin sharp zone.
- Narrow aperture such as f/16 widens the zone, but needs more light.
- Focus on the eye or the leading edge of the subject.
What the controls do
- A Focus distance slider and three aperture buttons.
Motion & timing
- The blur updates instantly.
- Reduced motion: nothing animates.
Tips & variations
- Use a tripod or focus rail for precision; handheld macro needs high shutter speeds.
- Focus stacking merges several shots when you need everything sharp.
Code of this live preview
<div class="bx"><div class="pre" id="pre" role="group" aria-label="Aperture"><button data-p="0" aria-pressed="true">f/2.8</button><button data-p="1" aria-pressed="false">f/8</button><button data-p="2" aria-pressed="false">f/16</button></div><div class="sc" id="sc"><i class="bgl"></i><i class="lf"></i><i class="bug"></i><i class="gr"></i></div><label class="rw">Focus <b id="fv">Subject</b><input id="fs" type="range" min="0" max="100" value="50"></label></div>:root{--bg:#F1F1EF;--surface:#fff;--surface-2:#F7F7F5;--line:#E0E0DC;--text:#171717;--muted:#6f6f6f;--accent:#171717;--accent-ink:#fff;--danger:#d92d20}
*{box-sizing:border-box;margin:0}
button{font:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer}a{color:inherit;text-decoration:none}ul,ol,p,h4{margin:0;padding:0}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.pre{display:flex;gap:5px;flex-wrap:wrap}.pre button{height:28px;padding:0 11px;border-radius:99px;border:1px solid var(--line);background:var(--surface);font-size:11px;cursor:pointer}
.pre button[aria-pressed=true]{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
.bx{width:min(330px,100%);display:grid;gap:9px}.rw{display:grid;gap:3px;font-size:11.5px;color:var(--muted)}.rw b{color:var(--text);font-weight:600}input[type=range]{width:100%;accent-color:#171717}
.out{font-size:12px;color:var(--muted);line-height:1.4}.out b{color:var(--text)}
button:focus-visible,input:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.sc{height:128px;border-radius:12px;position:relative;overflow:hidden;background:#b9d28a}.sc i{position:absolute;display:block}.bgl{inset:0;background:radial-gradient(circle at 20% 30%,rgba(255,240,150,.9) 0 14px,transparent 15px),radial-gradient(circle at 78% 24%,rgba(255,250,200,.8) 0 10px,transparent 11px),radial-gradient(circle at 64% 60%,rgba(255,230,120,.8) 0 18px,transparent 19px),#8fae5a;filter:blur(var(--bb))}.lf{left:18%;right:12%;top:46%;height:30%;border-radius:50%;background:linear-gradient(#5f9a3f,#3f7a2a);filter:blur(var(--lb))}.bug{left:50%;top:38%;width:30px;height:22px;margin-left:-15px;border-radius:50% 50% 44% 44%;background:radial-gradient(circle at 30% 30%,#e8423a,#b21f1a);filter:blur(var(--ub))}.bug::before{content:"";position:absolute;left:11px;top:2px;width:8px;height:2px;background:#111;box-shadow:-6px 5px 0 1px #111,6px 5px 0 1px #111,0 9px 0 1px #111}.gr{left:-4%;bottom:-6%;width:34%;height:70%;background:repeating-linear-gradient(80deg,#2e6b2a 0 8px,#4d9440 8px 16px);clip-path:polygon(0 100%,10% 20%,24% 100%,40% 10%,56% 100%,72% 30%,100% 100%);filter:blur(var(--gb))}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}const F=[2.8,8,16],sc=document.getElementById('sc'),fs=document.getElementById('fs'),bs=[...document.querySelectorAll('#pre button')],D={bgl:1,lf:.5,bug:.5,gr:0};let p=0;
function up(){const f=fs.value/100,k=8/F[p]*7,pos={bgl:1,lf:.62,ub:.5,gb:0},bl=d=>Math.abs(f-d)*k*Math.min(1,1.2);sc.style.setProperty('--bb',bl(1).toFixed(1)+'px');sc.style.setProperty('--lb',bl(.62).toFixed(1)+'px');sc.style.setProperty('--ub',bl(.5).toFixed(1)+'px');sc.style.setProperty('--gb',bl(0).toFixed(1)+'px');document.getElementById('fv').textContent=f<.2?'Foreground grass':f<.42?'Near leaf':f<.7?'Subject':'Far background';bs.forEach(b=>b.setAttribute('aria-pressed',String(+b.dataset.p===p)));}
bs.forEach(b=>b.addEventListener('click',()=>{p=+b.dataset.p;up();}));fs.addEventListener('input',up);up();One complete HTML file. Save it and open it in a browser.
<!doctype html>
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Macro Focus Plane — demo</title>
<style>
:root{--bg:#F1F1EF;--surface:#fff;--surface-2:#F7F7F5;--line:#E0E0DC;--text:#171717;--muted:#6f6f6f;--accent:#171717;--accent-ink:#fff;--danger:#d92d20}
*{box-sizing:border-box;margin:0}
html,body{height:100%}body{background:var(--bg);color:var(--text);font:15px/1.5 -apple-system,BlinkMacSystemFont,'Segoe UI',Inter,Roboto,sans-serif;-webkit-font-smoothing:antialiased}.stage{min-height:100%;display:grid;place-items:center;padding:24px}button,input,select,textarea{font-family:inherit}@media (prefers-reduced-motion:reduce){html{scroll-behavior:auto}}
button{font:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer}a{color:inherit;text-decoration:none}ul,ol,p,h4{margin:0;padding:0}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.pre{display:flex;gap:5px;flex-wrap:wrap}.pre button{height:28px;padding:0 11px;border-radius:99px;border:1px solid var(--line);background:var(--surface);font-size:11px;cursor:pointer}
.pre button[aria-pressed=true]{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
.bx{width:min(330px,100%);display:grid;gap:9px}.rw{display:grid;gap:3px;font-size:11.5px;color:var(--muted)}.rw b{color:var(--text);font-weight:600}input[type=range]{width:100%;accent-color:#171717}
.out{font-size:12px;color:var(--muted);line-height:1.4}.out b{color:var(--text)}
button:focus-visible,input:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.sc{height:128px;border-radius:12px;position:relative;overflow:hidden;background:#b9d28a}.sc i{position:absolute;display:block}.bgl{inset:0;background:radial-gradient(circle at 20% 30%,rgba(255,240,150,.9) 0 14px,transparent 15px),radial-gradient(circle at 78% 24%,rgba(255,250,200,.8) 0 10px,transparent 11px),radial-gradient(circle at 64% 60%,rgba(255,230,120,.8) 0 18px,transparent 19px),#8fae5a;filter:blur(var(--bb))}.lf{left:18%;right:12%;top:46%;height:30%;border-radius:50%;background:linear-gradient(#5f9a3f,#3f7a2a);filter:blur(var(--lb))}.bug{left:50%;top:38%;width:30px;height:22px;margin-left:-15px;border-radius:50% 50% 44% 44%;background:radial-gradient(circle at 30% 30%,#e8423a,#b21f1a);filter:blur(var(--ub))}.bug::before{content:"";position:absolute;left:11px;top:2px;width:8px;height:2px;background:#111;box-shadow:-6px 5px 0 1px #111,6px 5px 0 1px #111,0 9px 0 1px #111}.gr{left:-4%;bottom:-6%;width:34%;height:70%;background:repeating-linear-gradient(80deg,#2e6b2a 0 8px,#4d9440 8px 16px);clip-path:polygon(0 100%,10% 20%,24% 100%,40% 10%,56% 100%,72% 30%,100% 100%);filter:blur(var(--gb))}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}
</style></head>
<body><div class="stage">
<div class="bx"><div class="pre" id="pre" role="group" aria-label="Aperture"><button data-p="0" aria-pressed="true">f/2.8</button><button data-p="1" aria-pressed="false">f/8</button><button data-p="2" aria-pressed="false">f/16</button></div><div class="sc" id="sc"><i class="bgl"></i><i class="lf"></i><i class="bug"></i><i class="gr"></i></div><label class="rw">Focus <b id="fv">Subject</b><input id="fs" type="range" min="0" max="100" value="50"></label></div>
</div>
<script>
const F=[2.8,8,16],sc=document.getElementById('sc'),fs=document.getElementById('fs'),bs=[...document.querySelectorAll('#pre button')],D={bgl:1,lf:.5,bug:.5,gr:0};let p=0;
function up(){const f=fs.value/100,k=8/F[p]*7,pos={bgl:1,lf:.62,ub:.5,gb:0},bl=d=>Math.abs(f-d)*k*Math.min(1,1.2);sc.style.setProperty('--bb',bl(1).toFixed(1)+'px');sc.style.setProperty('--lb',bl(.62).toFixed(1)+'px');sc.style.setProperty('--ub',bl(.5).toFixed(1)+'px');sc.style.setProperty('--gb',bl(0).toFixed(1)+'px');document.getElementById('fv').textContent=f<.2?'Foreground grass':f<.42?'Near leaf':f<.7?'Subject':'Far background';bs.forEach(b=>b.setAttribute('aria-pressed',String(+b.dataset.p===p)));}
bs.forEach(b=>b.addEventListener('click',()=>{p=+b.dataset.p;up();}));fs.addEventListener('input',up);up();
</script>
</body></html>