Shadow Length & Sun Angle
A post and its shadow: a low sun gives a long soft shadow, a high sun a short dark one.
AI prompt
Landscape photograph at golden hour of a single tall wooden post standing in a field of pale grass, the low orange sun on the left casting a very long soft shadow stretching across the ground to the right, warm light on the post, long fine grass shadows, a pale gradient sky, 50mm lens, shallow depth of field, calm and graphic. Variants: mid-morning with a shadow as long as the post, and noon with a short hard dark shadow directly below. Negative: multiple light sources, short shadow with low sun, text, flash, people. Reduced motion: static image.About this pattern
Definition
Shadow length depends on the sun's height above the horizon: length equals object height divided by the tangent of the elevation. A low sun makes long, soft, faint shadows; a high sun makes short, dark, crisp ones. This is why photographers favour early and late light.
When to use it
- Sunrise and sunset: shadows several times the object's height, warm light and a soft edge.
- Mid-morning: shadow about the same length as the object.
- Noon: shadow almost directly underneath, hard and dark.
- In prompts, say long shadows stretching across the ground, or harsh overhead sun.
What the controls do
- A Sun height slider and three presets (Sunrise, Morning, Noon).
Motion & timing
- The shadow follows the slider directly; no easing.
- Reduced motion: nothing animates.
Tips & variations
- Keep shadow direction consistent with the sun position across the whole scene.
- Long shadows add depth and texture to flat ground; use them for drama.
Code of this live preview
<div class="bx"><div class="sc" id="sc"><i class="sn" id="sn"></i><div class="gd"></div><i class="sh" id="sh"></i><i class="po"></i></div><div class="pre" id="pre" role="group" aria-label="Sun"><button data-p="0" aria-pressed="true">Sunrise</button><button data-p="1" aria-pressed="false">Morning</button><button data-p="2" aria-pressed="false">Noon</button></div><label class="rw">Sun height <b id="hv">12°</b><input id="hg" type="range" min="5" max="90" value="12"></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:140px;border-radius:12px;position:relative;overflow:hidden;background:linear-gradient(var(--s1),var(--s2))}.gd{position:absolute;left:0;right:0;bottom:0;height:38%;background:linear-gradient(#cdbd8a,#b0a070)}
.sn{position:absolute;width:22px;height:22px;border-radius:50%;background:#fff6c8;box-shadow:0 0 20px 8px rgba(255,235,170,.8);transform:translate(-50%,-50%)}
.po{position:absolute;left:34%;bottom:24%;width:8px;height:56px;background:#7a5a3a;border-radius:2px 2px 0 0;box-shadow:inset -2px 0 0 rgba(0,0,0,.2)}
.sh{position:absolute;left:calc(34% + 4px);bottom:24%;height:6px;width:var(--l);background:linear-gradient(90deg,rgba(40,30,10,var(--o)),rgba(40,30,10,0));border-radius:3px;filter:blur(var(--b));transform-origin:0 50%}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}const P=[8,35,88],sc=document.getElementById('sc'),sn=document.getElementById('sn'),sh=document.getElementById('sh'),hg=document.getElementById('hg'),bs=[...document.querySelectorAll('#pre button')];
function up(){const el=+hg.value,r=el*Math.PI/180,len=Math.min(300,56/Math.tan(r)),x=10+(90-el)/85*0;sn.style.left=(12+(el-5)/85*30)+'%';sn.style.top=(78-(el-5)/85*66)+'%';
sh.style.setProperty('--l',len.toFixed(0)+'px');sh.style.setProperty('--o',(.18+el/90*.55).toFixed(2));sh.style.setProperty('--b',(Math.max(0,(40-el)/40*2.4)).toFixed(1)+'px');
const w=Math.max(0,1-el/45),m=(a,b)=>Math.round(a+(b-a)*w);sc.style.setProperty('--s1','rgb('+m(120,255)+','+m(170,190)+','+m(235,150)+')');sc.style.setProperty('--s2','rgb('+m(200,255)+','+m(225,225)+','+m(250,190)+')');
document.getElementById('hv').textContent=el+'°';bs.forEach(b=>b.setAttribute('aria-pressed',String(P[+b.dataset.p]===el)));}
bs.forEach(b=>b.addEventListener('click',()=>{hg.value=P[+b.dataset.p];up();}));hg.addEventListener('input',up);hg.value=12;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>Shadow Length & Sun Angle — 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:140px;border-radius:12px;position:relative;overflow:hidden;background:linear-gradient(var(--s1),var(--s2))}.gd{position:absolute;left:0;right:0;bottom:0;height:38%;background:linear-gradient(#cdbd8a,#b0a070)}
.sn{position:absolute;width:22px;height:22px;border-radius:50%;background:#fff6c8;box-shadow:0 0 20px 8px rgba(255,235,170,.8);transform:translate(-50%,-50%)}
.po{position:absolute;left:34%;bottom:24%;width:8px;height:56px;background:#7a5a3a;border-radius:2px 2px 0 0;box-shadow:inset -2px 0 0 rgba(0,0,0,.2)}
.sh{position:absolute;left:calc(34% + 4px);bottom:24%;height:6px;width:var(--l);background:linear-gradient(90deg,rgba(40,30,10,var(--o)),rgba(40,30,10,0));border-radius:3px;filter:blur(var(--b));transform-origin:0 50%}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}
</style></head>
<body><div class="stage">
<div class="bx"><div class="sc" id="sc"><i class="sn" id="sn"></i><div class="gd"></div><i class="sh" id="sh"></i><i class="po"></i></div><div class="pre" id="pre" role="group" aria-label="Sun"><button data-p="0" aria-pressed="true">Sunrise</button><button data-p="1" aria-pressed="false">Morning</button><button data-p="2" aria-pressed="false">Noon</button></div><label class="rw">Sun height <b id="hv">12°</b><input id="hg" type="range" min="5" max="90" value="12"></label></div>
</div>
<script>
const P=[8,35,88],sc=document.getElementById('sc'),sn=document.getElementById('sn'),sh=document.getElementById('sh'),hg=document.getElementById('hg'),bs=[...document.querySelectorAll('#pre button')];
function up(){const el=+hg.value,r=el*Math.PI/180,len=Math.min(300,56/Math.tan(r)),x=10+(90-el)/85*0;sn.style.left=(12+(el-5)/85*30)+'%';sn.style.top=(78-(el-5)/85*66)+'%';
sh.style.setProperty('--l',len.toFixed(0)+'px');sh.style.setProperty('--o',(.18+el/90*.55).toFixed(2));sh.style.setProperty('--b',(Math.max(0,(40-el)/40*2.4)).toFixed(1)+'px');
const w=Math.max(0,1-el/45),m=(a,b)=>Math.round(a+(b-a)*w);sc.style.setProperty('--s1','rgb('+m(120,255)+','+m(170,190)+','+m(235,150)+')');sc.style.setProperty('--s2','rgb('+m(200,255)+','+m(225,225)+','+m(250,190)+')');
document.getElementById('hv').textContent=el+'°';bs.forEach(b=>b.setAttribute('aria-pressed',String(P[+b.dataset.p]===el)));}
bs.forEach(b=>b.addEventListener('click',()=>{hg.value=P[+b.dataset.p];up();}));hg.addEventListener('input',up);hg.value=12;up();
</script>
</body></html>