# Letter helix that turns on scroll

> The phrase wraps around a 3D spiral that spins and rises as you scroll; letters at the back dim so the front reads clearly.

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

## Where to use it

This block winds a short phrase around a helix built with CSS 3D transforms. Scrolling inside the box turns the spiral and lifts it, a slow drift keeps it alive when nobody touches it, and each letter fades according to its depth so the front face stays legible. It works as a section opener, a festival poster or a playful brand motto.

Change the phrase in the text field; it repeats until the spiral is full. The main color tints the letters and the background glow. Screen readers get the phrase once as plain text, and with reduced motion the drift stops and only scroll moves it.

## Code

### HTML

```html
<div class="uvq14-hlx"><div class="sc" tabindex="0" aria-label="Turn the idea"><div class="tr"><div class="st"><p class="sr">Turn the idea</p><div class="hx" aria-hidden="true" translate="no"><b class="pre">Turn the idea</b></div><i class="ax" aria-hidden="true"></i></div></div></div><span class="hn" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 5v14M6 13l6 6 6-6"/></svg>Scroll</span></div>
```

### CSS

```css
.uvq14-hlx {
  --c1: #65a30d;
  --c2: #18181b;
  --s: 16px;
  /* tamaño */
  --k: 1;
  /* velocidad */
  --fg: #1d1d1f;
  /* texto */
  --bg: #f5f5f7;
  /* fondo */
}

.uvq14-hlx {
  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;
  position: relative;
  width: 22em;
  height: 17em;
  border-radius: 1.3em;
  overflow: hidden;
  background: color-mix(in srgb,var(--fg) 3%,var(--bg));
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 10%,transparent);
  background: radial-gradient(70% 60% at 50% 50%,color-mix(in srgb,var(--c1) 12%,var(--bg)),var(--bg));
}

.uvq14-hlx .sc {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  outline: 0;
}

.uvq14-hlx .tr {
  height: 300%;
}

.uvq14-hlx .st {
  position: sticky;
  top: 0;
  height: 17em;
  display: grid;
  place-items: center;
  overflow: hidden;
  perspective: 30em;
}

.uvq14-hlx .hx {
  position: relative;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
}

.uvq14-hlx .hx b {
  position: absolute;
  left: -.4em;
  top: -.5em;
  width: .8em;
  text-align: center;
  font-size: 2em;
  font-weight: 900;
  text-transform: uppercase;
  line-height: 1;
  color: color-mix(in srgb,var(--c1) 80%,var(--fg));
  backface-visibility: visible;
}

.uvq14-hlx .hx b.pre {
  left: 0;
  width: auto;
  white-space: nowrap;
  transform: translateX(-50%);
}

.uvq14-hlx .ax {
  position: absolute;
  left: 50%;
  top: 10%;
  bottom: 10%;
  width: 2px;
  margin-left: -1px;
  background: linear-gradient(transparent,color-mix(in srgb,var(--fg) 14%,transparent),transparent);
}

.uvq14-hlx .sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.uvq14-hlx .hn {
  position: absolute;
  left: 50%;
  bottom: .8em;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: .3em;
  padding: .35em .7em;
  border-radius: 2em;
  font-size: .7em;
  font-weight: 700;
  color: var(--bg);
  background: var(--fg);
  translate: -50% 0;
  pointer-events: none;
  transition: opacity calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
  animation: uvq14-hlx-h calc(1.6s / var(--k)) ease-in-out infinite;
}

.uvq14-hlx .hn svg {
  width: 1.1em;
  height: 1.1em;
}

.uvq14-hlx.moved .hn {
  opacity: 0;
}

.uvq14-hlx .sc:focus-visible {
  box-shadow: inset 0 0 0 2px var(--c1);
  border-radius: 1.3em;
}

@keyframes uvq14-hlx-h {
  50% {
    transform: translateY(.25em);
  }
}
```

### JavaScript

```js
document.querySelectorAll(".uvq14-hlx").forEach(el => {
  const sr=el.querySelector(".sr"),hx=el.querySelector(".hx");const rm=matchMedia("(prefers-reduced-motion: reduce)").matches;let L=[],raf=0,vis=false,t0=performance.now();
const build=()=>{hx.textContent="";L=[];const s=sr.textContent.trim()+" · ";let txt=s;while(txt.length<40)txt+=s;const N=txt.length,st=360/16;[...txt].forEach((c,i)=>{const b=document.createElement("b");b.textContent=c;b.style.transform="translateY("+((i-N/2)*.15).toFixed(2)+"em) rotateY("+(i*st).toFixed(1)+"deg) translateZ(2.6em)";hx.appendChild(b);L.push({b,a:i*st})})};
const draw=()=>{const p=parseFloat(el.style.getPropertyValue("--p"))||0,rot=-p*540-(rm?0:(performance.now()-t0)*.012);hx.style.transform="rotateX(-16deg) rotateY("+rot.toFixed(2)+"deg) translateY("+((.5-p)*2).toFixed(2)+"em)";L.forEach(o=>{const z=Math.cos((o.a+rot)*Math.PI/180);o.b.style.opacity=(.12+.88*Math.pow((z+1)/2,1.6)).toFixed(3)})};
const loop=()=>{draw();raf=vis&&!rm?requestAnimationFrame(loop):0};build();const sc=el.querySelector(".sc");const u=()=>{const m=sc.scrollHeight-sc.clientHeight;const p=m>0?sc.scrollTop/m:0;el.style.setProperty("--p",p.toFixed(4));el.classList.toggle("moved",sc.scrollTop>8);if(!raf)draw()};sc.addEventListener("scroll",u,{passive:true});const ro=new ResizeObserver(u);ro.observe(sc);u();const mo=new MutationObserver(build);el.querySelectorAll(".sr").forEach(n=>mo.observe(n,{childList:true,characterData:true,subtree:true}));const io=new IntersectionObserver(es=>{vis=es[0].isIntersecting;if(vis&&!raf)loop()});io.observe(el);draw();return()=>{ro.disconnect();mo.disconnect();io.disconnect();cancelAnimationFrame(raf)}
});
```

### 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-hlx {
  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;
  position: relative;
  width: 22em;
  height: 17em;
  border-radius: 1.3em;
  overflow: hidden;
  background: color-mix(in srgb,var(--fg) 3%,var(--bg));
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 10%,transparent);
  background: radial-gradient(70% 60% at 50% 50%,color-mix(in srgb,var(--c1) 12%,var(--bg)),var(--bg));
}

.uvq14-hlx .sc {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  outline: 0;
}

.uvq14-hlx .tr {
  height: 300%;
}

.uvq14-hlx .st {
  position: sticky;
  top: 0;
  height: 17em;
  display: grid;
  place-items: center;
  overflow: hidden;
  perspective: 30em;
}

.uvq14-hlx .hx {
  position: relative;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
}

.uvq14-hlx .hx b {
  position: absolute;
  left: -.4em;
  top: -.5em;
  width: .8em;
  text-align: center;
  font-size: 2em;
  font-weight: 900;
  text-transform: uppercase;
  line-height: 1;
  color: color-mix(in srgb,var(--c1) 80%,var(--fg));
  backface-visibility: visible;
}

.uvq14-hlx .hx b.pre {
  left: 0;
  width: auto;
  white-space: nowrap;
  transform: translateX(-50%);
}

.uvq14-hlx .ax {
  position: absolute;
  left: 50%;
  top: 10%;
  bottom: 10%;
  width: 2px;
  margin-left: -1px;
  background: linear-gradient(transparent,color-mix(in srgb,var(--fg) 14%,transparent),transparent);
}

.uvq14-hlx .sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.uvq14-hlx .hn {
  position: absolute;
  left: 50%;
  bottom: .8em;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: .3em;
  padding: .35em .7em;
  border-radius: 2em;
  font-size: .7em;
  font-weight: 700;
  color: var(--bg);
  background: var(--fg);
  translate: -50% 0;
  pointer-events: none;
  transition: opacity calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
  animation: uvq14-hlx-h calc(1.6s / var(--k)) ease-in-out infinite;
}

.uvq14-hlx .hn svg {
  width: 1.1em;
  height: 1.1em;
}

.uvq14-hlx.moved .hn {
  opacity: 0;
}

.uvq14-hlx .sc:focus-visible {
  box-shadow: inset 0 0 0 2px var(--c1);
  border-radius: 1.3em;
}

@keyframes uvq14-hlx-h {
  50% {
    transform: translateY(.25em);
  }
}
`;

// 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 sr=el.querySelector(".sr"),hx=el.querySelector(".hx");const rm=matchMedia("(prefers-reduced-motion: reduce)").matches;let L=[],raf=0,vis=false,t0=performance.now();
const build=()=>{hx.textContent="";L=[];const s=sr.textContent.trim()+" · ";let txt=s;while(txt.length<40)txt+=s;const N=txt.length,st=360/16;[...txt].forEach((c,i)=>{const b=document.createElement("b");b.textContent=c;b.style.transform="translateY("+((i-N/2)*.15).toFixed(2)+"em) rotateY("+(i*st).toFixed(1)+"deg) translateZ(2.6em)";hx.appendChild(b);L.push({b,a:i*st})})};
const draw=()=>{const p=parseFloat(el.style.getPropertyValue("--p"))||0,rot=-p*540-(rm?0:(performance.now()-t0)*.012);hx.style.transform="rotateX(-16deg) rotateY("+rot.toFixed(2)+"deg) translateY("+((.5-p)*2).toFixed(2)+"em)";L.forEach(o=>{const z=Math.cos((o.a+rot)*Math.PI/180);o.b.style.opacity=(.12+.88*Math.pow((z+1)/2,1.6)).toFixed(3)})};
const loop=()=>{draw();raf=vis&&!rm?requestAnimationFrame(loop):0};build();const sc=el.querySelector(".sc");const u=()=>{const m=sc.scrollHeight-sc.clientHeight;const p=m>0?sc.scrollTop/m:0;el.style.setProperty("--p",p.toFixed(4));el.classList.toggle("moved",sc.scrollTop>8);if(!raf)draw()};sc.addEventListener("scroll",u,{passive:true});const ro=new ResizeObserver(u);ro.observe(sc);u();const mo=new MutationObserver(build);el.querySelectorAll(".sr").forEach(n=>mo.observe(n,{childList:true,characterData:true,subtree:true}));const io=new IntersectionObserver(es=>{vis=es[0].isIntersecting;if(vis&&!raf)loop()});io.observe(el);draw();return()=>{ro.disconnect();mo.disconnect();io.disconnect();cancelAnimationFrame(raf)}
}

export default function TxHelixScroll() {
  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": "#65a30d",
          "--c2": "#18181b",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq14-hlx"><div className="sc" tabIndex={0} aria-label="Turn the idea"><div className="tr"><div className="st"><p className="sr">Turn the idea</p><div className="hx" aria-hidden="true" translate="no"><b className="pre">Turn the idea</b></div><i className="ax" aria-hidden="true"></i></div></div></div><span className="hn" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d="M12 5v14M6 13l6 6 6-6" /></svg>Scroll</span></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 “Letter helix that turns on scroll” block (Text & scroll) from AIMRAN Library to my project.

## What it is
The phrase wraps around a 3D spiral that spins and rises as you scroll; letters at the back dim so the front reads clearly.

## Chosen settings
- Main color: #65a30d
- Secondary color: #18181b
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "Gira la idea"

## 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-hlx {
  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;
  position: relative;
  width: 22em;
  height: 17em;
  border-radius: 1.3em;
  overflow: hidden;
  background: color-mix(in srgb,var(--fg) 3%,var(--bg));
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 10%,transparent);
  background: radial-gradient(70% 60% at 50% 50%,color-mix(in srgb,var(--c1) 12%,var(--bg)),var(--bg));
}

.uvq14-hlx .sc {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  outline: 0;
}

.uvq14-hlx .tr {
  height: 300%;
}

.uvq14-hlx .st {
  position: sticky;
  top: 0;
  height: 17em;
  display: grid;
  place-items: center;
  overflow: hidden;
  perspective: 30em;
}

.uvq14-hlx .hx {
  position: relative;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
}

.uvq14-hlx .hx b {
  position: absolute;
  left: -.4em;
  top: -.5em;
  width: .8em;
  text-align: center;
  font-size: 2em;
  font-weight: 900;
  text-transform: uppercase;
  line-height: 1;
  color: color-mix(in srgb,var(--c1) 80%,var(--fg));
  backface-visibility: visible;
}

.uvq14-hlx .hx b.pre {
  left: 0;
  width: auto;
  white-space: nowrap;
  transform: translateX(-50%);
}

.uvq14-hlx .ax {
  position: absolute;
  left: 50%;
  top: 10%;
  bottom: 10%;
  width: 2px;
  margin-left: -1px;
  background: linear-gradient(transparent,color-mix(in srgb,var(--fg) 14%,transparent),transparent);
}

.uvq14-hlx .sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.uvq14-hlx .hn {
  position: absolute;
  left: 50%;
  bottom: .8em;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: .3em;
  padding: .35em .7em;
  border-radius: 2em;
  font-size: .7em;
  font-weight: 700;
  color: var(--bg);
  background: var(--fg);
  translate: -50% 0;
  pointer-events: none;
  transition: opacity calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
  animation: uvq14-hlx-h calc(1.6s / var(--k)) ease-in-out infinite;
}

.uvq14-hlx .hn svg {
  width: 1.1em;
  height: 1.1em;
}

.uvq14-hlx.moved .hn {
  opacity: 0;
}

.uvq14-hlx .sc:focus-visible {
  box-shadow: inset 0 0 0 2px var(--c1);
  border-radius: 1.3em;
}

@keyframes uvq14-hlx-h {
  50% {
    transform: translateY(.25em);
  }
}
`;

// 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 sr=el.querySelector(".sr"),hx=el.querySelector(".hx");const rm=matchMedia("(prefers-reduced-motion: reduce)").matches;let L=[],raf=0,vis=false,t0=performance.now();
const build=()=>{hx.textContent="";L=[];const s=sr.textContent.trim()+" · ";let txt=s;while(txt.length<40)txt+=s;const N=txt.length,st=360/16;[...txt].forEach((c,i)=>{const b=document.createElement("b");b.textContent=c;b.style.transform="translateY("+((i-N/2)*.15).toFixed(2)+"em) rotateY("+(i*st).toFixed(1)+"deg) translateZ(2.6em)";hx.appendChild(b);L.push({b,a:i*st})})};
const draw=()=>{const p=parseFloat(el.style.getPropertyValue("--p"))||0,rot=-p*540-(rm?0:(performance.now()-t0)*.012);hx.style.transform="rotateX(-16deg) rotateY("+rot.toFixed(2)+"deg) translateY("+((.5-p)*2).toFixed(2)+"em)";L.forEach(o=>{const z=Math.cos((o.a+rot)*Math.PI/180);o.b.style.opacity=(.12+.88*Math.pow((z+1)/2,1.6)).toFixed(3)})};
const loop=()=>{draw();raf=vis&&!rm?requestAnimationFrame(loop):0};build();const sc=el.querySelector(".sc");const u=()=>{const m=sc.scrollHeight-sc.clientHeight;const p=m>0?sc.scrollTop/m:0;el.style.setProperty("--p",p.toFixed(4));el.classList.toggle("moved",sc.scrollTop>8);if(!raf)draw()};sc.addEventListener("scroll",u,{passive:true});const ro=new ResizeObserver(u);ro.observe(sc);u();const mo=new MutationObserver(build);el.querySelectorAll(".sr").forEach(n=>mo.observe(n,{childList:true,characterData:true,subtree:true}));const io=new IntersectionObserver(es=>{vis=es[0].isIntersecting;if(vis&&!raf)loop()});io.observe(el);draw();return()=>{ro.disconnect();mo.disconnect();io.disconnect();cancelAnimationFrame(raf)}
}

export default function TxHelixScroll() {
  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": "#65a30d",
          "--c2": "#18181b",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq14-hlx"><div className="sc" tabIndex={0} aria-label="Turn the idea"><div className="tr"><div className="st"><p className="sr">Turn the idea</p><div className="hx" aria-hidden="true" translate="no"><b className="pre">Turn the idea</b></div><i className="ax" aria-hidden="true"></i></div></div></div><span className="hn" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d="M12 5v14M6 13l6 6 6-6" /></svg>Scroll</span></div>
      </div>
    </>
  );
}
```

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