# Extruded headline that follows the light

> Pop poster letters with depth: a fourteen-layer extrusion changes direction as if the pointer were a spotlight.

- Category: [Text & scroll](https://library.aimran.es/components/text-scroll)
- Built with: HTML + CSS
- Live editor: https://library.aimran.es/blocks/uv-tx-extrude-3d
- Library: AIMRAN Library (https://library.aimran.es), free, no sign-up, by Aimran Oukham

## Where to use it

Fourteen stacked text shadows give this headline a solid 3D block under its outlined face, like a pop art poster or an arcade title. Two CSS variables set the direction, and a few lines of JavaScript point them away from the cursor, so the letters seem lit by it. When idle, the light circles slowly on its own. It suits events, games, sales and bold campaigns.

Write the headline in the text field and choose the face color with the main color and the extrusion with the secondary one. The halftone background uses the same accent. On phones a tap moves the light, and with reduced motion the extrusion stays still.

## Code

### HTML

```html
<div class="uvq14-ext"><h3 class="hl">Type with depth</h3><p class="cp">Move the pointer or tap to move the light</p></div>
```

### CSS

```css
.uvq14-ext {
  --c1: #fde047;
  --c2: #e11d48;
  --s: 16px;
  /* tamaño */
  --k: 1;
  /* velocidad */
  --fg: #1d1d1f;
  /* texto */
  --bg: #f5f5f7;
  /* fondo */
}

.uvq14-ext {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  width: 19em;
  padding: 1.4em 1em;
  box-sizing: border-box;
  display: grid;
  justify-items: center;
  gap: 1.2em;
  border-radius: 1.3em;
  background: radial-gradient(color-mix(in srgb,var(--c2) 22%,transparent) 18%,transparent 20%) 0 0/.7em .7em;
  --dx: .6;
  --dy: .8;
  touch-action: manipulation;
}

.uvq14-ext .hl {
  margin: 0;
  text-align: center;
  font: 900 calc(var(--s) * 3.4)/.95 "Arial Black","Helvetica Neue",Arial,sans-serif;
  letter-spacing: -.03em;
  text-transform: uppercase;
  color: var(--c1);
  -webkit-text-stroke: .025em #1a1a1a;
  paint-order: stroke fill;
  text-shadow: calc(var(--dx) * 0.011em) calc(var(--dy) * 0.011em) 0 var(--c2),calc(var(--dx) * 0.022em) calc(var(--dy) * 0.022em) 0 var(--c2),calc(var(--dx) * 0.033em) calc(var(--dy) * 0.033em) 0 var(--c2),calc(var(--dx) * 0.044em) calc(var(--dy) * 0.044em) 0 var(--c2),calc(var(--dx) * 0.055em) calc(var(--dy) * 0.055em) 0 var(--c2),calc(var(--dx) * 0.066em) calc(var(--dy) * 0.066em) 0 var(--c2),calc(var(--dx) * 0.077em) calc(var(--dy) * 0.077em) 0 var(--c2),calc(var(--dx) * 0.088em) calc(var(--dy) * 0.088em) 0 var(--c2),calc(var(--dx) * 0.099em) calc(var(--dy) * 0.099em) 0 var(--c2),calc(var(--dx) * 0.110em) calc(var(--dy) * 0.110em) 0 var(--c2),calc(var(--dx) * 0.121em) calc(var(--dy) * 0.121em) 0 var(--c2),calc(var(--dx) * 0.132em) calc(var(--dy) * 0.132em) 0 var(--c2),calc(var(--dx) * 0.143em) calc(var(--dy) * 0.143em) 0 var(--c2),calc(var(--dx) * 0.154em) calc(var(--dy) * 0.154em) 0 #1a1a1a,calc(var(--dx) * .3em) calc(var(--dy) * .3em) .3em rgba(0,0,0,.25);
  transition: text-shadow calc(0.15s / var(--k)) linear;
}

.uvq14-ext .cp {
  margin: 0;
  font-size: .72em;
  font-weight: 600;
  color: color-mix(in srgb,var(--fg) 58%,transparent);
}
```

### JavaScript

```js
document.querySelectorAll(".uvq14-ext").forEach(el => {
  const rm=matchMedia("(prefers-reduced-motion: reduce)").matches;let raf=0,idle=true,tm=0,t0=performance.now();
const set=(x,y)=>{const l=Math.hypot(x,y)||1,k=Math.min(1,l);el.style.setProperty("--dx",(x/l*k).toFixed(3));el.style.setProperty("--dy",(y/l*k).toFixed(3))};
const orbit=()=>{const a=(performance.now()-t0)/1400;set(Math.cos(a),Math.sin(a)*.8+.2);raf=idle?requestAnimationFrame(orbit):0};
const aim=e=>{idle=false;cancelAnimationFrame(raf);raf=0;clearTimeout(tm);const r=el.getBoundingClientRect();set(-((e.clientX-r.left)/r.width-.5)*2.4,-((e.clientY-r.top)/r.height-.5)*2.4);tm=setTimeout(()=>{if(!rm){idle=true;t0=performance.now()-Math.atan2(parseFloat(el.style.getPropertyValue("--dy"))||0,parseFloat(el.style.getPropertyValue("--dx"))||1)*1400;orbit()}},2400)};
el.addEventListener("pointermove",aim);el.addEventListener("pointerdown",aim);
if(!rm)orbit();return()=>{cancelAnimationFrame(raf);clearTimeout(tm)}
});
```

### React

```tsx
// @ts-nocheck: setup() es JavaScript del DOM sin tipos, el mismo de la pestaña JS.
import { useEffect, useRef, type CSSProperties } from "react";

const css = `
.uvq14-ext {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  width: 19em;
  padding: 1.4em 1em;
  box-sizing: border-box;
  display: grid;
  justify-items: center;
  gap: 1.2em;
  border-radius: 1.3em;
  background: radial-gradient(color-mix(in srgb,var(--c2) 22%,transparent) 18%,transparent 20%) 0 0/.7em .7em;
  --dx: .6;
  --dy: .8;
  touch-action: manipulation;
}

.uvq14-ext .hl {
  margin: 0;
  text-align: center;
  font: 900 calc(var(--s) * 3.4)/.95 "Arial Black","Helvetica Neue",Arial,sans-serif;
  letter-spacing: -.03em;
  text-transform: uppercase;
  color: var(--c1);
  -webkit-text-stroke: .025em #1a1a1a;
  paint-order: stroke fill;
  text-shadow: calc(var(--dx) * 0.011em) calc(var(--dy) * 0.011em) 0 var(--c2),calc(var(--dx) * 0.022em) calc(var(--dy) * 0.022em) 0 var(--c2),calc(var(--dx) * 0.033em) calc(var(--dy) * 0.033em) 0 var(--c2),calc(var(--dx) * 0.044em) calc(var(--dy) * 0.044em) 0 var(--c2),calc(var(--dx) * 0.055em) calc(var(--dy) * 0.055em) 0 var(--c2),calc(var(--dx) * 0.066em) calc(var(--dy) * 0.066em) 0 var(--c2),calc(var(--dx) * 0.077em) calc(var(--dy) * 0.077em) 0 var(--c2),calc(var(--dx) * 0.088em) calc(var(--dy) * 0.088em) 0 var(--c2),calc(var(--dx) * 0.099em) calc(var(--dy) * 0.099em) 0 var(--c2),calc(var(--dx) * 0.110em) calc(var(--dy) * 0.110em) 0 var(--c2),calc(var(--dx) * 0.121em) calc(var(--dy) * 0.121em) 0 var(--c2),calc(var(--dx) * 0.132em) calc(var(--dy) * 0.132em) 0 var(--c2),calc(var(--dx) * 0.143em) calc(var(--dy) * 0.143em) 0 var(--c2),calc(var(--dx) * 0.154em) calc(var(--dy) * 0.154em) 0 #1a1a1a,calc(var(--dx) * .3em) calc(var(--dy) * .3em) .3em rgba(0,0,0,.25);
  transition: text-shadow calc(0.15s / var(--k)) linear;
}

.uvq14-ext .cp {
  margin: 0;
  font-size: .72em;
  font-weight: 600;
  color: color-mix(in srgb,var(--fg) 58%,transparent);
}
`;

// Interacción en JavaScript del DOM: la misma que en la pestaña JS.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function setup(el: any) {
  const rm=matchMedia("(prefers-reduced-motion: reduce)").matches;let raf=0,idle=true,tm=0,t0=performance.now();
const set=(x,y)=>{const l=Math.hypot(x,y)||1,k=Math.min(1,l);el.style.setProperty("--dx",(x/l*k).toFixed(3));el.style.setProperty("--dy",(y/l*k).toFixed(3))};
const orbit=()=>{const a=(performance.now()-t0)/1400;set(Math.cos(a),Math.sin(a)*.8+.2);raf=idle?requestAnimationFrame(orbit):0};
const aim=e=>{idle=false;cancelAnimationFrame(raf);raf=0;clearTimeout(tm);const r=el.getBoundingClientRect();set(-((e.clientX-r.left)/r.width-.5)*2.4,-((e.clientY-r.top)/r.height-.5)*2.4);tm=setTimeout(()=>{if(!rm){idle=true;t0=performance.now()-Math.atan2(parseFloat(el.style.getPropertyValue("--dy"))||0,parseFloat(el.style.getPropertyValue("--dx"))||1)*1400;orbit()}},2400)};
el.addEventListener("pointermove",aim);el.addEventListener("pointerdown",aim);
if(!rm)orbit();return()=>{cancelAnimationFrame(raf);clearTimeout(tm)}
}

export default function TxExtrude3d() {
  const ref = useRef<HTMLDivElement>(null);

  useEffect(() => {
    const el = ref.current?.firstElementChild;
    return el ? setup(el) : undefined;
  }, []);

  return (
    <>
      <style>{css}</style>
      <div
        ref={ref} style={{
          "--c1": "#fde047",
          "--c2": "#e11d48",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq14-ext"><h3 className="hl">Type with depth</h3><p className="cp">Move the pointer or tap to move the light</p></div>
      </div>
    </>
  );
}
```

## Prompt for AI assistants

Paste this into ChatGPT, Claude, Cursor, v0 or Lovable to adapt the block to your stack (Tailwind, Vue, Svelte…):

````text
I want to add the “Extruded headline that follows the light” block (Text & scroll) from AIMRAN Library to my project.

## What it is
Pop poster letters with depth: a fourteen-layer extrusion changes direction as if the pointer were a spotlight.

## Chosen settings
- Main color: #fde047
- Secondary color: #e11d48
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "Tipo con volumen"

## What I need
1. Add it to my project with the same look and animation as the reference code: same sizes, colours, radii, shadows, timings and easing.
2. It is built with plain HTML and CSS (the reference wraps it in a React component with its CSS). If my project uses something else (Vue, Svelte, Astro, plain HTML…), translate it without losing any behaviour. If I use Tailwind, turn the styles into classes; if not, keep the CSS in its own file.
3. Expose the settings above as props (or CSS variables) with those values as defaults.
4. Make it work well on phones: nothing that depends only on hover, touch targets of at least 44 px and no overflow on 320 px screens.
5. Make it look right in light and dark mode.
6. Keep it accessible: semantic HTML, roles and aria-* where needed, visible focus and keyboard support.
7. Respect prefers-reduced-motion: with reduced motion, no big animations but the same end result.

## Reference code
```tsx
// @ts-nocheck: setup() es JavaScript del DOM sin tipos, el mismo de la pestaña JS.
import { useEffect, useRef, type CSSProperties } from "react";

const css = `
.uvq14-ext {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  width: 19em;
  padding: 1.4em 1em;
  box-sizing: border-box;
  display: grid;
  justify-items: center;
  gap: 1.2em;
  border-radius: 1.3em;
  background: radial-gradient(color-mix(in srgb,var(--c2) 22%,transparent) 18%,transparent 20%) 0 0/.7em .7em;
  --dx: .6;
  --dy: .8;
  touch-action: manipulation;
}

.uvq14-ext .hl {
  margin: 0;
  text-align: center;
  font: 900 calc(var(--s) * 3.4)/.95 "Arial Black","Helvetica Neue",Arial,sans-serif;
  letter-spacing: -.03em;
  text-transform: uppercase;
  color: var(--c1);
  -webkit-text-stroke: .025em #1a1a1a;
  paint-order: stroke fill;
  text-shadow: calc(var(--dx) * 0.011em) calc(var(--dy) * 0.011em) 0 var(--c2),calc(var(--dx) * 0.022em) calc(var(--dy) * 0.022em) 0 var(--c2),calc(var(--dx) * 0.033em) calc(var(--dy) * 0.033em) 0 var(--c2),calc(var(--dx) * 0.044em) calc(var(--dy) * 0.044em) 0 var(--c2),calc(var(--dx) * 0.055em) calc(var(--dy) * 0.055em) 0 var(--c2),calc(var(--dx) * 0.066em) calc(var(--dy) * 0.066em) 0 var(--c2),calc(var(--dx) * 0.077em) calc(var(--dy) * 0.077em) 0 var(--c2),calc(var(--dx) * 0.088em) calc(var(--dy) * 0.088em) 0 var(--c2),calc(var(--dx) * 0.099em) calc(var(--dy) * 0.099em) 0 var(--c2),calc(var(--dx) * 0.110em) calc(var(--dy) * 0.110em) 0 var(--c2),calc(var(--dx) * 0.121em) calc(var(--dy) * 0.121em) 0 var(--c2),calc(var(--dx) * 0.132em) calc(var(--dy) * 0.132em) 0 var(--c2),calc(var(--dx) * 0.143em) calc(var(--dy) * 0.143em) 0 var(--c2),calc(var(--dx) * 0.154em) calc(var(--dy) * 0.154em) 0 #1a1a1a,calc(var(--dx) * .3em) calc(var(--dy) * .3em) .3em rgba(0,0,0,.25);
  transition: text-shadow calc(0.15s / var(--k)) linear;
}

.uvq14-ext .cp {
  margin: 0;
  font-size: .72em;
  font-weight: 600;
  color: color-mix(in srgb,var(--fg) 58%,transparent);
}
`;

// Interacción en JavaScript del DOM: la misma que en la pestaña JS.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function setup(el: any) {
  const rm=matchMedia("(prefers-reduced-motion: reduce)").matches;let raf=0,idle=true,tm=0,t0=performance.now();
const set=(x,y)=>{const l=Math.hypot(x,y)||1,k=Math.min(1,l);el.style.setProperty("--dx",(x/l*k).toFixed(3));el.style.setProperty("--dy",(y/l*k).toFixed(3))};
const orbit=()=>{const a=(performance.now()-t0)/1400;set(Math.cos(a),Math.sin(a)*.8+.2);raf=idle?requestAnimationFrame(orbit):0};
const aim=e=>{idle=false;cancelAnimationFrame(raf);raf=0;clearTimeout(tm);const r=el.getBoundingClientRect();set(-((e.clientX-r.left)/r.width-.5)*2.4,-((e.clientY-r.top)/r.height-.5)*2.4);tm=setTimeout(()=>{if(!rm){idle=true;t0=performance.now()-Math.atan2(parseFloat(el.style.getPropertyValue("--dy"))||0,parseFloat(el.style.getPropertyValue("--dx"))||1)*1400;orbit()}},2400)};
el.addEventListener("pointermove",aim);el.addEventListener("pointerdown",aim);
if(!rm)orbit();return()=>{cancelAnimationFrame(raf);clearTimeout(tm)}
}

export default function TxExtrude3d() {
  const ref = useRef<HTMLDivElement>(null);

  useEffect(() => {
    const el = ref.current?.firstElementChild;
    return el ? setup(el) : undefined;
  }, []);

  return (
    <>
      <style>{css}</style>
      <div
        ref={ref} style={{
          "--c1": "#fde047",
          "--c2": "#e11d48",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq14-ext"><h3 className="hl">Type with depth</h3><p className="cp">Move the pointer or tap to move the light</p></div>
      </div>
    </>
  );
}
```

Give me the complete final code, ready to paste, and tell me in one line where to put it in my project.
````
