Ink reveal
A paragraph that is read as it is inked. The text waits pale, at a fifth of its strength, and takes its full colour word by word as the page brings it up the window, from the first word to the last, and gives it back when the page goes down again.
Documentation
-
Copy to Webflow
Add Instrument Sans and Geist Mono to your site's fonts (Site settings, Fonts, Google Fonts) before pasting: Webflow removes any font your site has not installed. -
Add custom CSS
Custom CSS in WebflowThis CSS already ships inside the Webflow embed, so a pasted section needs nothing added. Paste it yourself, in the page or the site custom code, only if the effect runs on several pages. The tutorial explains where.
See the tutorialThe stylesheet dims a text by itself only while the script loads, at the strength of the bare text, so it never shows fully inked first: without the script, under reduced motion and in the Designer, the text is all inked. The colour of the text belongs to the page: the ink is the colour of each word, and the pale state is a share of it, the settingrest, so the effect works on any ground. One variable is yours to set, on the marked text or on anything above it:--ink-reveal-fresh, the colour of the ink that has just been laid. A block near the end of the page needs no room under it: its run ends when the page stops scrolling. -
Add custom JS
Custom JavaScript in WebflowThis script already ships inside the Webflow embed, settings block included. You paste it yourself, before the closing body tag of the page or the site custom code, only when the effect has to run on several pages, and the tutorial says how to choose.
See the tutorial -
Use it on your own elements
How to add a custom attribute in WebflowA custom attribute is a pair, a name and a value, typed in the Settings panel of the element you selected, under Custom attributes. The name is what the script looks for, the value is what it reads. The tutorial shows the panel.
See the tutorialCustom attributesSelect the element on the canvas and open the Settings panel. Under Custom attributes, add a pair: the name on the left, the value on the right.Custom attribute What it does data-ink-reveal Marks the block whose words take ink. It takes no value: leave the value field empty. It goes on the element that carries the words: a Paragraph, a Heading, or a Rich Text element, static or bound to a CMS field, whose paragraphs then fill one after the other as a single run. Links, italics and spans inside it stay as they are. The settings below go on the same element. data-ink-reveal-skip On an inline element inside a marked text: its words are left out and stay as written. [ Optional ] data-ink-reveal-state Written by the engine on the block: idle before the first word, running, full, or reduced when the text is left as written under reduced motion. Never written by hand. [ Optional ] data-ink-reveal-engine Written by the engine on the root element (html) once its first pass over the page has run. Until then the stylesheet paints the marked words at the strength of the bare text, so they never show fully inked and then drop back while the engine loads. Never written by hand. [ Optional ] SettingsEvery setting is a custom attribute too, added the same way and on the same element. An attribute always wins over the defaults written in the code.Attribute Default What it is data-ink-reveal-rest 0.2 How much ink a word holds before its turn, as a share of its own colour, from 0 to 1. data-ink-reveal-softness 0.01 The width of the edge of the ink, as a share of the run: how much of the text is between bare and inked at once. The edge is never narrower than a letter and a half. data-ink-reveal-from 0.85 Where the run starts, as a share of the window height measured from the top: 1 is the bottom edge. It is the top of the text that is measured. data-ink-reveal-to 0.45 Where the run ends, as a share of the window height: the run is over when the foot of the text reaches that line. data-ink-reveal-rewind true Whether the ink drains again when the page is scrolled back up. Options: true, the ink follows the scroll both ways; false, the ink stays where it got to. data-ink-reveal-dry 0.6 The time the fresh ink takes to dry once the page stops, in seconds. It is also how long the streak is at a slow scroll. data-ink-reveal-pause 1 How long the ink rests on punctuation, from 0 to 3: at 1, the scroll of about nine letters after a full stop and three after a comma.
Two files, no build step.
It runs in the browser only. Load it with a script tag in plain HTML, in a
client-side script in Astro, never in the frontmatter. In React, call
InkReveal.mount(ref.current) in useEffect and
destroy() in its cleanup.
-
Tune it, either way
Per element with an attribute, or once for the whole site by editingDEFAULTSat the top of the file.Attribute Default What it is Lower Higher data-ink-reveal-rest 0.2 How much ink a word holds before its turn, as a share of its own colour, from 0 to 1. The waiting words nearly vanish, and the block reads as text appearing rather than filling The waiting words are almost as strong as the inked ones, and the effect becomes a whisper data-ink-reveal-softness 0.01 The width of the edge of the ink, as a share of the run: how much of the text is between bare and inked at once. The edge is never narrower than a letter and a half. A sharp edge that crosses one word at a time A long gradient of half inked words; at 1 the whole block fills together with no reading order data-ink-reveal-from 0.85 Where the run starts, as a share of the window height measured from the top: 1 is the bottom edge. It is the top of the text that is measured. The text comes further up the window before anything inks; under 0.6 the first lines are read bare The ink starts as soon as the text shows; over 1 the first words are inked before the text is in sight data-ink-reveal-to 0.45 Where the run ends, as a share of the window height: the run is over when the foot of the text reaches that line. The last word inks only near the top of the window, so the ink lags behind the reading The text is all inked while it is still low in the window; close to from a short text inks in a few pixels of scroll data-ink-reveal-rewind true Whether the ink drains again when the page is scrolled back up. Options: true, the ink follows the scroll both ways; false, the ink stays where it got to. data-ink-reveal-dry 0.6 The time the fresh ink takes to dry once the page stops, in seconds. It is also how long the streak is at a slow scroll. The streak is short and gone at once; 0 removes the fresh ink, and the text goes straight from bare to inked The accent lingers after the page has stopped; over 1.2 it reads as a highlight left behind data-ink-reveal-pause 1 How long the ink rests on punctuation, from 0 to 3: at 1, the scroll of about nine letters after a full stop and three after a comma. The ink runs through the text at one even pace; 0 gives no rest The ink waits visibly at the end of each sentence; over 2 a text of short sentences inks in fits and starts -
Drive it from JavaScript
When a text arrives after the page has loaded, when its words change, or when the page reacts to a text being all inked.const element = document.querySelector('[data-ink-reveal]'); element.addEventListener('inkreveal:done', (e) => { console.log(e.detail); }); const block = InkReveal.mount(element); // the block auto() mounted, or a new one block.progress(); // the share of it that is inked, from 0 to 1 block.refresh(); // after changing its words or an attribute element.addEventListener('inkreveal:done', () => { // the last word has just been inked }); // Text added after the page loaded: mount everything marked inside it. InkReveal.auto(container); // When the block leaves the page: InkReveal.destroy(element); // the words go back exactly as they were
-
Fit it to your page
The text
- One attribute. Mark the paragraph, or the block that holds the paragraphs. One sentence or three paragraphs: the ink goes from the first word of the marked element to its last, over the scroll it takes the element to go from
fromtoto. - Several texts on a page each follow their own place in the window. Mark each paragraph on its own for texts that ink one after the other; mark the block around them for one ink that runs through them all.
- Links, italics, bold, spans stay the elements they were. A link is reached by Tab and followed whether its words are inked or not.
- A word inks in its own colour. The bare text is the same colour at the strength
rest. A span in another colour, the accent in the preview, waits in that colour at the same strength and keeps it once inked. - The lines are the browser's. Nothing is measured line by line, so a text that breaks differently at another width needs nothing.
The colours
--ink-reveal-fresh: the colour of the ink that has just been laid,#ff4a00in the preview. A custom property, set at zero specificity on the marked element: give it your own value on the element or on anything above it.- The strength of the text not inked yet is the setting
rest,0.2by default. On a light page0.16to0.25reads as grey. It travels as--ink-reveal-rest, which a rule of your own may set instead.
The colour of the ink is the
colorof the text itself.In Webflow
- A Paragraph or a Heading: select it, open the Settings panel (the gear), and under Custom attributes add the name
data-ink-revealwith the value left empty. A setting is one more pair on the same element: namedata-ink-reveal-rest, value0.15. - A Rich Text element: put the attribute on the Rich Text element itself, not on a paragraph inside it, which has no Settings panel. The ink then runs through all its paragraphs and headings as one run.
- A Rich Text bound to a CMS field works the same: the attribute is on the element, the words come from the item, and the engine wraps them on the published page whatever the item holds. Bold, italic and links of the field are kept. Pictures, videos and embeds inside the field are left alone and stay at full strength.
- A few words in another colour: select them in the text, wrap them in a span from the toolbar of the text, and give the span a class with that colour.
- On the canvas the text is plain and fully inked: the Designer runs no Embed. The ink shows on the published site.
From JavaScript
InkReveal.mount(element, overrides)returns the handle of a block, mounting it if it was not:{ element, settings, units, state(), progress(), hold(), release(), refresh(), destroy() }.InkReveal.auto(root)mounts every marked block insideroot, and runs once on its own;InkReveal.refresh(element)andInkReveal.destroy(element)call the methods of the same name.unitsare the spans the words were wrapped in, in order.progress()is the share of the text that is inked, from 0 to 1.refresh()reads the attributes again and wraps the words again, after the text or a setting was changed.hold(share, seconds)takes the ink away from the scroll: it travels to that share of the text, from 0 to 1, in that many seconds at an even pace, at once without them, and stays there with its head fresh.release()gives it back to the scroll. A text inked on a timer, or posed for a picture, is these two calls.- Events, bubbling from the block:
inkreveal:readyonce it is mounted, with{ element, units, unit, reduced };inkreveal:enterandinkreveal:leaveas it comes into the window and leaves it, with{ element, units, progress };inkreveal:donethe first time its last word is inked, with{ element, units }.unitsis the number of words. - The state is in the markup:
data-ink-reveal-stateon the block,idlebefore the first word,running,full, orreduced. Once its first pass over the page has run, the engine also writesdata-ink-reveal-engineon the root (html). - Nothing shows fully inked before the engine. While the script loads, the stylesheet paints the words of a marked block at the strength of the bare text, the same mix of their own colour the engine gives a word it has not reached yet, so the text never shows fully inked and then drops back. Nothing moves: only the fill of the letters changes. The strength is read from
data-ink-reveal-restwhere the browser can read a number out of an attribute (Chrome and Edge 133 and later), from--ink-reveal-restelsewhere. The engine's mark on the root ends it. With scripts off, under reduced motion, in print, in forced colours and in the Webflow Designer, the text stays fully inked; if no engine has come after ten seconds, it is fully inked again. - Page-wide settings:
window.InkRevealSettings = { rest: 0.15 }, before the script. An attribute on a block wins over it. - **Under
prefers-reduced-motion: reduce** nothing is wrapped and the text stands all inked. - Without JavaScript the text is the text, all inked.
- The note of the demo was written for it: on a real page every word is the user's own.
- One attribute. Mark the paragraph, or the block that holds the paragraphs. One sentence or three paragraphs: the ink goes from the first word of the marked element to its last, over the scroll it takes the element to go from
-
Avoid the pitfalls
- The script should run early: at the end of the body, not
asyncfrom a slow host, and withfetchpriority="high"in a page of large pictures, as in the demo. Until it runs the text waits at its bare strength, and a text the window has already passed inks at once when it mounts. - The strength kept before mounting is the block's own. A
restset only inwindow.InkRevealSettingsor from code is not seen by the stylesheet: the text waits at--ink-reveal-rest, then takes the strength of the setting when the engine mounts. Write it on the block, or set the variable to the same value. - A text at the very top of a page is partly inked when the page opens, as far as its place in the window says. That is meant: the first lines can be read. They wait bare while the script loads, then ink at once when it mounts. Lower
fromfor less. - A text at the very foot of a page cannot be brought up to
to: its last word is inked when the page reaches its end. - The ink is a gradient clipped to the letters of each word. A
coloron the text or on a span reaches it. A-webkit-text-fill-color, abackgroundor atext-shadowof your own on the text does not go with it. - The underline of a link is not inked: it keeps the colour the link gives it. Give it a quiet
text-decoration-color, as the preview does. - Text changed after the mount is not wrapped: call
refresh(). - A parent that scrolls on its own is followed, but
fromandtostay shares of the window, not of that parent. - In React or any framework that owns the DOM, mount in an effect and call
destroy()in its cleanup: the engine wraps each word of the text in a span.
- The script should run early: at the end of the body, not
One click on Copy the AI prompt copies everything an assistant needs to build this effect: the complete code, the markup, the dependency, every setting and every pitfall.
What it does
Ink reveal is a text animation for Webflow and vanilla JavaScript, with no library. Also called text fill on scroll, word by word text reveal on scroll or scroll text color change.
A paragraph that is read as it is inked. The text waits pale, at a fifth of its strength, and takes its full colour word by word as the page brings it up the window, from the first word to the last, and gives it back when the page goes down again. The ink does not switch on: it runs through the letters as one soft edge, and what has just been inked is fresh, in the accent colour, a streak most of a line long that follows the reading and fades into the colour of the text behind it. Stop the page and it dries in half a second; move again and it is wet again. The ink rests a moment after a full stop and a shorter one after a comma, so the text is inked at the pace it is read. A word inks in its own colour: a span in the accent keeps the accent, like ink that never dried. One attribute on a paragraph, a heading or a block of several paragraphs is all it takes; links, italics and spans inside stay the elements they were, the lines break where they broke, and several texts on a page each follow their own place. The text stays real text, selectable and read whole by a screen reader. A jump of the page, an anchor or a drag of the scrollbar, puts a text that was out of sight where it belongs at once and never plays what it went over. Without JavaScript and under reduced motion the text is simply there, all inked. No library: this version replaces the one that ran on GSAP and ScrollTrigger, and the same attribute and settings keep working. Pattern type scroll fill text, ink fill, text fill on scroll, reading highlight, word by word fill.
Updated
Questions
Add the custom attribute data-ink-reveal, with an empty value, to the Paragraph, the Heading or the Rich Text element that carries the words, under Custom attributes in the Settings panel. One mark on a Rich Text of three paragraphs gives one run across the three, and it works the same when the Rich Text is bound to a CMS field: the words of the item are wrapped on the published page.
No. It needs no library: the engine wraps each word itself and paints it with a gradient clipped to its letters, and one scroll listener serves every marked text of the page. The earlier version ran on GSAP and ScrollTrigger; a page that still loads them is not affected.
data-ink-reveal-rest is the ink a waiting word holds, 0.2 by default: lower and the waiting words nearly vanish, higher and they are almost as strong as the inked ones. The streak of fresh ink takes the colour of --ink-reveal-fresh, and data-ink-reveal-dry, 0.6 seconds by default, is how long it takes to dry once the page stops; 0 removes it.
It starts when the top of the block reaches from, 0.85 of the window height measured from the top, and is over when the foot of the block reaches to, 0.45. Scrolling back up drains the ink again unless you set data-ink-reveal-rewind="false". A block at the very bottom of the page is all inked when the page reaches its end.
Yes. Each word is wrapped in a bare inline span and the spaces stay real text nodes, so the text is selectable, found by the browser's search and read as a sentence. Without JavaScript the text is fully inked, and under prefers-reduced-motion: reduce the words are not wrapped at all.