Extruded Long Shadow
斜投影拉伸
An uninterrupted diagonal extrusion extends a silhouette to form a long, unblurred shadow.
Where to use it
Add physical depth to sparse identity marks, short headings, or editorial icons. Reserve enough space along the projection direction for the shadow and keep its angle consistent across a series of marks.
Practical example
A design festival uses a blocky “27” on its schedule cover. The number casts a continuous shadow down and to the right, which ends cleanly at the edge of the colored panel.
AI prompt
Give [mark] a deliberately long diagonal shadow. Reuse its silhouette and interpolate consecutive offsets along a consistent projection vector so the shadow is continuous. Clip at the background boundary and preserve a readable high-contrast face.
Example code
Save the standalone HTML as a file and open it in your browser. It uses the same code as the preview.
View HTML
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Extruded Long Shadow</title>
<style>
:root {
color-scheme: dark;
--demo-bg: #171629;
--demo-ink: #f8f5ff;
--demo-accent: #b9a6ff;
--demo-muted: #bfbbd3;
font-family: system-ui, sans-serif;
color: var(--demo-ink);
background: var(--demo-bg);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 0; }
button, input { font: inherit; }
.demo {
display: grid;
place-items: center;
align-content: center;
min-height: 100vh;
padding: 14px;
overflow: hidden;
background: radial-gradient(ellipse at 50% 24%, #28233f, var(--demo-bg) 78%);
}
.demo-button {
border: 1px solid #ffffff3d;
border-radius: 7px;
background: #ffffff12;
color: var(--demo-ink);
padding: 6px 11px;
font-size: 12px;
cursor: pointer;
}
:focus-visible {
outline: 2px solid var(--demo-accent);
outline-offset: 3px;
}
.specimen {
display: grid;
width: min(100%, 356px);
gap: 8px;
margin: 0;
justify-items: center;
}
.specimen canvas {
display: block;
width: 100%;
aspect-ratio: 2;
max-height: max(72px, calc(100vh - 65px));
border-radius: 11px;
background: linear-gradient(145deg, #232943, #14172c);
box-shadow: 0 8px 22px #090a16a8;
}
.specimen label {
display: grid;
width: 100%;
min-height: 25px;
grid-template-columns: minmax(0, auto) minmax(56px, 1fr);
align-items: center;
gap: 8px;
color: var(--demo-ink);
font-size: 12px;
}
.specimen input {
width: 100%;
margin: 0;
accent-color: #b9a6ff;
}
@media (prefers-reduced-motion: reduce) {
.specimen [data-loop-toggle] { display: none; }
}
</style>
</head>
<body>
<main class="demo">
<figure class="specimen">
<canvas role="img" aria-label="Extruded Long Shadow" width="288" height="144">Extruded Long Shadow</canvas>
<label for="specimen-setting">Length<input id="specimen-setting" type="range" min="0" max="100" value="72"></label>
</figure>
</main>
<script>
(() => {
const canvas = document.querySelector('.specimen canvas');
const ctx = canvas.getContext('2d');
if (!ctx) {
document.querySelector('.specimen :is(input, button)').disabled = true;
return;
}
const width = 288;
const height = 144;
const turn = Math.PI * 2;
let elapsed = 0;
let variation = 0.72;
function dot(x, y, radius, ink) {
ctx.fillStyle = ink;
ctx.beginPath();
ctx.arc(x, y, radius, 0, turn);
ctx.fill();
}
function mix(a, b, amount) {
return a + (b - a) * amount;
}
function draw(_time, amount) {
ctx.fillStyle = '#e6b96b';
ctx.fillRect(0, 0, width, height);
ctx.font = '850 59px system-ui, sans-serif';
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
const distance = Math.round(amount * 99);
ctx.fillStyle = '#a85453';
for (let depth = distance; depth > 0; depth--) {
ctx.fillText('FORM', 144 + depth * .79, 70 + depth * .57);
}
ctx.fillStyle = '#2b253c';
ctx.fillText('FORM', 144, 70);
}
function render() {
const ratio = Math.min(devicePixelRatio || 1, 2);
const pixelsWide = Math.max(1, Math.round(canvas.clientWidth * ratio));
const pixelsTall = Math.max(1, Math.round(canvas.clientHeight * ratio));
if (canvas.width !== pixelsWide || canvas.height !== pixelsTall) {
canvas.width = pixelsWide;
canvas.height = pixelsTall;
}
ctx.setTransform(pixelsWide / width, 0, 0, pixelsTall / height, 0, 0);
ctx.clearRect(0, 0, width, height);
ctx.save();
draw(elapsed, variation);
ctx.restore();
}
render();
new ResizeObserver(render).observe(canvas);
const input = document.querySelector('#specimen-setting');
input.addEventListener('input', () => {
variation = Number(input.value) / 100;
render();
});
})();
</script>
</body>
</html>Original example by UI Skills