Resources

Attachments

Behavior you add to any element with an attachment. Each one is a single file in src/lib/attachments.

[ Animate - Attachment ]

Fades or slides an element in as it scrolls into view. Adds the class animate, then animated once it is in view. Scroll up and down to replay.

Available options:

  • variant fade | up | down | left | right | scale. Defaults to up.
  • once A boolean. Animate in only the first time (default), or replay each time it re-enters the viewport with false.
  • delay A number, seconds to wait before animating in.
  • duration A number, seconds the transition lasts.
  • stagger A number, seconds between each child. When set, the element's children animate in one after another.
  • trigger A string, a selector for another element that triggers the animation.
  • offset A number, the percent of the viewport height the element must clear from the bottom edge. Defaults to 2.
fade
up
down
left
right
scale

With stagger, the children animate in sequence.

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

[ Bg Slide - Attachment ]

Slides a block of color across a button on hover: out of a solid button, into an outline button. Use it on Button. The color is the accent, or --bg-slide-color.

Available options:

  • direction 'right' | 'left' | 'up' | 'down'. The way the color slides. Defaults to right.

[ Cursor Content - Attachment ]

Shows a message or icon inside the custom cursor while the mouse is over an element. Needs <MouseCursor />, which this page mounts.

Available options:

  • message A string shown inside the cursor.
  • icon An icon name from static/icons, or true for the cursor's default icon.
  • iconSize sm | md | lg. Defaults to sm.
  • iconColor Any CSS color for the icon.
  • image A picture path shown inside the cursor, e.g. /images/img-sample-1.jpg.
  • imageLayer front | behind. Whether the picture sits over the cursor's message and icon or under them. Defaults to behind.
  • iconSwap A second icon name the cursor swaps to each time the element is clicked, e.g. play and pause.
  • variant A string, the name of a look defined in <MouseCursor variants>.
  • tilt A boolean or tilt options (max, reverse, velocityMax, inSpeed, outSpeed, idleMs) to tilt the cursor by how fast the mouse moves. A picture tilts slightly by default; pass false to stop it.

Basic example on text.

Good design rewards a closer look, so hover over this phrase and the cursor opens into a picture that follows the mouse until it leaves the words.

"View project"
"Play Video"
Hover me

[ Cursor Field - Attachment ]

Declares a boundary a child element leans toward the mouse inside of. It does not need the custom cursor. Commonly used for video play buttons.

Available options:

  • child A selector inside the field, or an element. Defaults to the first child.
  • ease ease | spring | instant. Defaults to ease.
  • followSpeed A number from 0 to 1, how quickly the child follows the pointer. Defaults to 0.08.
  • returnSpeed A number from 0 to 1, how quickly the child returns to the center. Defaults to 0.06.
  • bounce A number from 0 to 1, how bouncy a spring is. Defaults to 0.6.
  • tilt A boolean or tilt options (max, reverse, velocityMax, inSpeed, outSpeed, idleMs).

hello

[ Cursor Hide - Attachment ]

Hides the custom cursor while the mouse is over an element. Needs <MouseCursor />.

Cursor hidden here

[ Cursor Target - Attachment ]

Detaches the cursor from the mouse and sits it on a target element while the pointer is over the trigger. Needs <MouseCursor />. Each trigger names its own target, so repeated instances never collide.

Available options:

  • target A selector, an element, or a function that returns one. The element the cursor sits on.
  • variant A string, the name of a look defined in <MouseCursor variants> while snapped.
  • event enter | move. Snap as soon as the pointer enters, or on the first movement over it. Defaults to move.

Hover me — move cursor to the dot

•

Hover me — move cursor to the star (it moves with a magnet) ★

Hover me — move cursor to the first square ◼︎

Hover me — move cursor to the second square ◼︎

[ Flip - Attachment ]

Tips an element back and swings it forward as it scrolls into view, or ties the tilt to scroll position with scrub. Scrub eases take GSAP-style names.

Available options:

  • from top | center | bottom. The edge the element pivots from. Defaults to top.
  • trigger A selector or element to watch for scrolling instead of the flipped element itself.
  • start A string, the scroll position the effect starts at (element point, viewport point). Defaults to top 98%.
  • end A string, the scroll position it ends at. Defaults to bottom top.
  • scrub A boolean. Tie the tilt to scroll position instead of playing the swing. Defaults to false.
  • ease A GSAP-style name such as back.out(2) or elastic.out(1, 0.4), or a function. Only used while scrubbing. Defaults to none.
  • once A boolean. Only swing the first time it comes into view. Ignored while scrubbing.
Standard flip
Flip from bottom
Scrubbed flip (tied to scroll)
Scrubbed flip with elastic swing

[ Glass - Attachment ] Limited Availability

A liquid-glass panel. Chromium refracts what is behind it with an SVG filter that is rebuilt when the element resizes; other browsers get a frosted blur. It uses the element's ::before for an edge highlight.

Available options:

  • blur A number, the blur radius in px. Browsers without refraction only. Defaults to 12.
  • saturate A number, saturation in percent. Browsers without refraction only. Defaults to 140.
  • scale A number, refraction strength in px. Chromium only. Defaults to 40.
  • tint dark for a darker tint over light content, or any CSS color.
Default glass (push me)
Stronger scale (magnet)
Dark tint (tilt)

[ Glitch Cycle - Attachment ]

Swaps text between words with GSAP's text scrambler, only while it is on screen. A mono-spaced font keeps the width from jumping as the letters change.

Available options:

  • words An array of strings, the words to cycle through in order. Required.
  • colors An array of colors (any CSS color, including variables) to fade to along with each word.
  • interval A number, milliseconds between each word. Defaults to 2000.
  • chars A GSAP preset (upperCase | lowerCase | upperAndLowerCase) or your own string of characters to scramble through.
  • mono A boolean. Use the mono-spaced font. Defaults to true.

Sample: Creative

[ Glitch Hover - Attachment ]

Scrambles an element's text when it is hovered or focused. Works on a Button's label, or any element.

Available options:

  • newText A string. Scramble into this text on hover, and back to the original on leave.
  • out A boolean. Also scramble when the pointer leaves or focus moves away. Always on with newText. Defaults to false.
  • target A selector inside the element, or an element, whose text scrambles. Defaults to a .label (as in Button), else the element itself.
  • chars A GSAP preset or your own string of characters to scramble through.
  • duration A number, seconds the effect lasts. Defaults to 0.5.
  • revealDelay A number, seconds between each character settling. Defaults to 0.125.

[ Glitch Scroll - Attachment ]

Scrambles text each time it scrolls into view. Scroll up and down to replay.

Available options:

  • chars A GSAP preset or your own string of characters to scramble through.
  • revealDelay A number, seconds between each character settling. Defaults to 0.05.
  • duration A number, seconds the effect lasts. Defaults to 0.75.
  • once A boolean. Only scramble the first time it scrolls into view. Defaults to false.
  • trigger A selector or element to watch instead of this element, e.g. a pinned section.
  • start A string, the scroll position the effect starts at. Defaults to top 98%.
  • end A string, the scroll position it ends at. Defaults to bottom 2%.
  • mono A boolean. Use the mono-spaced font. Defaults to true.

This will glitch out as many times as you scroll into view. Default behavior.

This will only glitch out once.

This will glitch when the "glitch-target" heading below comes into view.
Great for pinned sections.

[ Glitch Target - Attachment ]

Hovering or focusing one element scrambles another. Give it the target as an element reference, a selector, or a function.

Available options:

  • target A selector, an element, or a function that returns one. The element whose text scrambles. Required.
  • chars A GSAP preset or your own string of characters to scramble through.
  • duration A number, seconds the effect lasts. Defaults to 0.75.
  • revealDelay A number, seconds between each character settling. Defaults to 0.125.

This text should now glitch out

[ Gradient Border - Attachment ]

A gradient border that can be static, animated, or follow the pointer. It uses the element's ::before.

Available options:

  • width A number, the border width in px. Defaults to 1 (3 when animated).
  • angle A number, the gradient angle in degrees. Defaults to 135.
  • color Any CSS color, including variables.
  • length short | long. How much of the border the gradient covers.
  • animate true sweeps around the element forever; 'hover' reveals it on hover.
  • duration A number, seconds per sweep. Defaults to 2.5.
  • rayTrace A boolean. A glow that follows the pointer. Give the element its own background.

Static

Default
gradient border
Configured
gradient border
Configured
gradient border

Animated

Passive animation
Configured example

Ray tracing

Follow mouse
Somewhat ray tracing
OMG so it's good
Pretty cool

[ Grid Fade - Attachment ]

A grid of tiles over an element that fades away, or away and back, as it scrolls into view.

Available options:

  • type in | in-out. Fade the tiles away, or away and back. Defaults to in.
  • size sm | md | lg. The tile size. Defaults to md.
  • sequence random | linear | circular. The order tiles fade: shuffled, left to right, or outward from the center. Defaults to random.
  • scrub A boolean. Tie the fade to scroll position instead of playing it. Defaults to true.
  • once A boolean. Only play the first time. Applies when scrub is false.
  • duration A number, seconds the fade lasts. Applies when scrub is false. Defaults to 1.5.
  • start A string, the scroll position the fade starts at. The default depends on type and scrub.
  • end A string, the scroll position it ends at. The default depends on type and scrub.
Scrubbed fade in (default)
Played once over 2s, non scrub
Scrubbed fade in-out, linear

[ Magnet - Attachment ]

Pulls an element toward the pointer while it is hovered. Mouse and reduced-motion aware. A CSS transition follows the pointer while a script settles it back, which together give the soft return.

Available options:

  • x A number, the horizontal pull as a fraction of the pointer's distance from the center. Defaults to 0.5.
  • y A number, the vertical pull. Defaults to 0.5.
  • followDuration A number, milliseconds the element takes to catch up to its target. Defaults to 640.
  • followEase A CSS easing for catching up. Defaults to the site's easing.
  • returnDuration A number, milliseconds the target takes to travel back. Defaults to 220.
  • returnEase cubic-bezier(...), linear, ease, ease-out or ease-in-out. Values above 1 overshoot. Try cubic-bezier(0, 1.64, 0.63, 1.92) for a bounce.
Default Magnet
Subtle / Weak Magnet
Strong Magnet with return ease

[ Paper Grain - Attachment ]

Lays a faint construction-paper texture over an element's background: long fibers, tiny flecks. It is SVG noise used as a mask, so there are no image files, and it sits under the content.

Available options:

  • variant 'fibers' | 'flecks' | 'pulp'. Long lines like the fibers in paper stock, with a few specks; tiny scattered flecks; lines crossed over a soft mottle. Defaults to fibers.
  • opacity A number from 0 to 1. Defaults to 0.1.
  • color Any CSS color. Defaults to the text color, so it follows the theme.
  • size A number, pixels before the noise tile repeats. Defaults to 480.
Fibers
Flecks
Pulp

[ Parallax - Attachment ]

Shifts an element as it scrolls through the viewport. Off with reduced motion. Swap from and to to move against the scroll, like the rocket, which drifts up as the page scrolls down.

Available options:

  • from A number, the starting offset as a percent of the element's height. Defaults to -5.
  • to A number, the ending offset. Defaults to 5.

[ Push - Attachment ]

For mouse users: the element is pushed the way the pointer was moving when it entered, spun a little depending on where it was hit, and then eases back. Off with reduced motion and ignores touch. It uses the translate and rotate properties, so it can share an element with tilt.

Available options:

  • strength A number, the sensitivity of the push (how far the element moves). Defaults to 10.
  • restore A number from 0 to 1, how quickly the element settles back. Lower is slower. Defaults to 0.1.
  • maxRotate A number, the most rotation in degrees the push adds. Use 0 to remove the effect. Defaults to 25.

Basic example on text.

Mouse over me!
Mouse over me!

[ Roll - Attachment ]

For links, buttons and icons. On hover or keyboard focus the content rolls out one side and a copy takes its place from the other, like a slot machine. It can roll letter by letter, word by word, or all at once, so it also works on a social icon. Plain CSS and a little script, no GSAP. Screen readers get the original content. Off with reduced motion. Do not combine it with a glitch attachment on the same text.

Available options:

  • split chars | words | whole. What rolls: each letter, each word, or everything in the target at once, which works on icons and any markup. Defaults to chars.
  • from start | end | center | edges | random. Where the roll begins, for chars and words: center rolls outward and edges rolls inward. random picks a new order on every hover. Defaults to start.
  • direction up | down | left | right. The way the content leaves; the copy arrives from the opposite side. Each letter or word clips its own copy, so a sideways roll stays inside its place. Defaults to up.
  • rewind A boolean. By default the roll plays backward when the pointer leaves. With false it never rolls back: every time the pointer or keyboard focus arrives it rolls on to the next copy, always the same way. Defaults to true.
  • stagger A number, seconds between each piece starting. Defaults to 0.02.
  • duration A number, seconds each piece takes. Defaults to 0.6.
  • target A selector or element that holds the content. Defaults to a .label (as in Button), else the element itself.

[ Scribble - Attachment ]

Draws a hand-drawn scribble on an element, like a line made with a dry brush: an underline under it, or a circle drawn around it. Shown from the start by default, on a word, a button or a whole paragraph, or drawn in on hover and focus with hover, or when it scrolls into view with scroll. The underline follows a cubic Bézier from the left edge to the right at mid-height, a blunt start that thickens quickly and tapers into a ragged, broken tail, with rough, chipped edges and optional dry streaks inside, different for every element unless you give it a seed. Pick a preset, or paste a curve from the same curve tool the Marquee Curve uses, to get a dip and a rise of your own. On a Button it replaces the underline. The Header Basic menu uses it, with random, on its links.

Available options:

  • type 'underline' or 'circle'. The circle is an uneven oval drawn around the element in one quick pass that overshoots its start and ends in a tail that does not meet the beginning. On hover it is drawn in along its path. Defaults to 'underline'.
  • padding A number, how far the circle sits out from the element, in em. Defaults to 0.4.
  • scale A number that multiplies padding for a circle: 1.2 draws the loop farther out, 0.8 closer in. Defaults to 1.
  • curve For an underline: a preset, or a cubic-bezier(x1, y1, x2, y2), or the four numbers. The smooth presets are 'swoosh' (the default), 'wave', 'dip' and 'flat'. 'zigzag' (straight, then one or two shallow there-and-backs, then straight) and 'notch' (a single V dip) are made of straight lines. 'random' picks one of them for each element, so every one gets a different line. The line runs from the left edge to the right at mid-height; the two points pull it, and a y of 1 is the top and 0 the bottom.
  • hover A boolean. Draws the scribble in on hover and keyboard focus instead of showing it from the start. Defaults to false.
  • scroll A boolean. Draws the scribble in when the element scrolls into view instead of showing it from the start. Loads GSAP ScrollTrigger only when used, and with reduced motion it just shows. Defaults to false.
  • start For scroll: a ScrollTrigger-style start, the element's point then the viewport's, such as 'top 85%' (the default) or 'bottom center'.
  • end For scroll: a ScrollTrigger-style end. With once: false the scribble resets past it. Defaults to 'bottom 2%'.
  • once For scroll: true draws it the first time only (the default). false draws it each time it scrolls into view and resets when it leaves.
  • trigger For scroll: a selector or element to watch for scrolling instead of this element, such as a whole section.
  • markers For scroll: a boolean that shows GSAP's start and end markers for debugging. Defaults to false.
  • thickness A number from 0 to 1, the widest point as a share of the box height. Thins or thickens the line without changing its curve. Defaults to 0.35.
  • rough A number from 0 to 1. How ragged the edges are: they wobble and get chipped in places, like spray paint or a dry brush. 0 is smooth. Defaults to 0.5.
  • streaks A number, how many thin dry streaks are left bare inside the line, like bristles that ran out of paint. 0 is solid. Defaults to 0.
  • seed A number. The same seed draws the same line every time. Without one, every line is different.
  • color A string, any CSS color. Defaults to the accent. Also set with --scribble-color.
  • height A string, the height of the box the line is drawn in. A shorter box makes the whole line slimmer and flattens its curve too. Defaults to 0.7em.
  • offset A string, how far the box sits below the element. Defaults to -0.4em.

Shown from the start

A scribble under a few words of a sentence, and another in a different color and shape.

On a whole paragraph the scribble spans the element, under its last line. This one picks a random shape, so reloading the page draws it differently.

A circle around a few words in the middle of a sentence, and one more.

On hover and focus

Drawn in on scroll

Scroll these into view and they are drawn in: an underline, a circle, and a paragraph below that resets and draws again every time it re-enters.

This paragraph starts its scribble when its top reaches 75% of the screen, and draws it again each time it scrolls back into view.

[ Scroll Slide - Attachment ]

Pins an element to the center of the screen and slides a row inside it sideways as the page scrolls, for exactly as far as the row overflows, then lets go. Put it on the pinned element, mark the box the row slides across with data-slide-viewport and the row with data-slide-track (or point at your own with viewport and track). While it is active the element has data-sliding, which is when the viewport should clip. It needs GSAP ScrollTrigger, loaded only when used, and does nothing when motion is reduced, so the row can scroll on its own. Gallery Horizontal and Scroll Horizontal in Sections use it.

Available options:

  • viewport A selector inside for the box the row slides across. Defaults to [data-slide-viewport].
  • track A selector inside for the row that slides. Defaults to [data-slide-track].
  • media A media query. Outside it nothing is pinned. Defaults to (min-width: 1024px); use all for every size.
  • scrub A number, seconds the row takes to catch up with the scroll. Defaults to 1.
  • parallax A selector for elements inside the row that drift sideways as it slides, such as images in frames.
  • parallaxAmount A number, how far they drift as a percent of their own width. Defaults to 25.

[ Text Curve - Attachment ]

Bends an element's text along a circular arc. Screen readers still get the plain text. It sizes the element to fit the arc, and measures again on resize and when fonts load. The spin is off with reduced motion.

Available options:

  • radius A number, how strongly the text curves. Positive bends it like a smile, negative like a frown, and larger numbers curve it more. Defaults to 1.
  • kerning A number, extra pixels between characters. Defaults to 0.
  • centered A boolean. Shifts the text so the arc is centered in the element instead of sitting along its top or bottom. Defaults to false.
  • spin 'right' | 'left'. Rotates the element forever, clockwise or counter-clockwise.
  • spinDuration A number, seconds per turn. Defaults to 10 for right and 12 for left.

This is the sample of a basic text curve.

Negative radius swaps the curve.

HELLO CURVED WORLD. THE OUTSIDE IS WAITING.

HELLO CURVED WORLD. THE OUTSIDE IS WAITING.

[ Text Fade - Attachment ]

Fades text in word by word or character by character as it scrolls into view. Uses GSAP ScrollTrigger and SplitText. Off with reduced motion.

Available options:

  • type words | chars. What the text is split into. Defaults to words.
  • style 'random' | 'linear'. Whether the pieces animate in random order or from first to last. Defaults to random.
  • duration A number, seconds each piece takes. Defaults to 0.25.
  • stagger A number, seconds between each piece starting. Defaults to 0.0125.
  • ease A string, a GSAP ease such as back.out(2). Defaults to linear.
  • once A boolean. Only play the first time it scrolls into view instead of every time. Ignored with scrub. Defaults to false.
  • scrub A boolean. Tie the animation to the scroll position instead of playing it. Defaults to false.
  • start A string, where the animation starts: an element point and a viewport point, e.g. top 80%. Defaults to top 98%.
  • end A string, where the animation ends, e.g. bottom 60%. Defaults to bottom 2%.
  • markers A boolean. Shows GSAP start and end markers for debugging. Defaults to false.
  • trigger A selector or element to watch for scrolling instead of this one, e.g. a pinned section.

This fades in word by word in a random order. Lorem ipsum dolor sit amet consectetur adipisicing elit. Error iste corrupti tempora aspernatur, consequatur blanditiis, repellat, quibusdam perferendis sequi dignissimos dolores? Magni, nisi quae.

This fades in character by character, only the first time it scrolls into view.

This one is scrubbed: it fades in as you scroll. Lorem ipsum dolor sit amet consectetur adipisicing elit. Error iste corrupti tempora aspernatur, consequatur blanditiis, repellat, quibusdam perferendis sequi dignissimos dolores? Magni, nisi quae.

[ Text Fill - Attachment ]

Fills text with color as it scrolls into view. It scrubs with the scroll by default. The unfilled color comes from --text-fill-base. Put it on an inline element (a <span> inside the heading or paragraph) so it fills line by line; as a direct child of a flex or grid container it becomes a block and fills all lines at once. Uses GSAP ScrollTrigger. Off with reduced motion.

Available options:

  • duration A number, seconds each piece takes. Defaults to 1.
  • once A boolean. Only play the first time it scrolls into view instead of every time. Ignored with scrub. Defaults to false.
  • scrub A boolean. Tie the animation to the scroll position instead of playing it. Defaults to true.
  • start A string, where the animation starts: an element point and a viewport point, e.g. top 80%. Defaults to top 90%.
  • end A string, where the animation ends, e.g. bottom 60%. Defaults to bottom 60%.
  • markers A boolean. Shows GSAP start and end markers for debugging. Defaults to false.
  • trigger A selector or element to watch for scrolling instead of this one, e.g. a pinned section.

This heading fills as you scroll.

A paragraph can fill too, and it follows each wrapped line. Lorem ipsum dolor sit amet consectetur adipisicing elit. Error iste corrupti tempora aspernatur, consequatur blanditiis, repellat, quibusdam perferendis sequi dignissimos dolores? Magni, nisi quae.

Not scrubbed: this fills over five seconds, only once, after it passes 80% of the viewport.

[ Text Flip - Attachment ]

Tips text forward into place, piece by piece, as it scrolls into view. Uses GSAP ScrollTrigger and SplitText. Off with reduced motion.

Available options:

  • type words | chars | lines. What the text is split into. Defaults to words.
  • from 'top' | 'center' | 'bottom'. The edge the pieces tip forward from. Defaults to top.
  • duration A number, seconds each piece takes. Defaults to 1.
  • stagger A number, seconds between each piece starting. Defaults to 0.05.
  • ease A string, a GSAP ease such as back.out(2). Defaults to power2.out.
  • once A boolean. Only play the first time it scrolls into view instead of every time. Ignored with scrub. Defaults to false.
  • scrub A boolean. Tie the animation to the scroll position instead of playing it. Defaults to false.
  • start A string, where the animation starts: an element point and a viewport point, e.g. top 80%. Defaults to top 98%.
  • end A string, where the animation ends, e.g. bottom 60%. Defaults to bottom 2%.
  • markers A boolean. Shows GSAP start and end markers for debugging. Defaults to false.
  • trigger A selector or element to watch for scrolling instead of this one, e.g. a pinned section.

Each word tips forward and settles, scrubbed with the scroll. Lorem ipsum dolor sit amet consectetur adipisicing elit. Error iste corrupti tempora aspernatur, consequatur blanditiis, repellat, quibusdam perferendis sequi dignissimos dolores? Magni, nisi quae.

Split by lines, so each line flips in turn no matter how the text wraps. Lorem ipsum dolor sit amet consectetur adipisicing elit. Error iste corrupti tempora aspernatur, consequatur blanditiis, repellat, quibusdam perferendis sequi dignissimos dolores? Magni, nisi quae.

Flipping up from the bottom edge, only the first time.

An elastic ease gives it a decaying swing.

[ Text Intro - Attachment ]

Plays once when the element mounts, not on scroll. The text reveals piece by piece at the right edge of its section (the nearest section), then the whole element travels left to where it really sits. Meant for a hero heading: pass it to Section Copy's titleAttach. Demoed on the Intros page. Uses GSAP and SplitText. Off with reduced motion.

Available options:

  • type words | chars. What the text is split into. Defaults to words.
  • duration A number, seconds each piece takes. Defaults to 0.6.
  • stagger A number, seconds between each piece starting. Defaults to 0.08.
  • ease A string, a GSAP ease such as back.out(2). Defaults to power3.out.
  • travel A number, seconds the text takes to travel to its place. Defaults to 1.2.
  • travelEase A GSAP ease for the travel. Defaults to power3.inOut.
  • hold A number, seconds to wait before the travel starts. Defaults to 0.15.
  • delay A number, seconds to wait before anything starts, e.g. for a loader to lift. Defaults to 0.

[ Text Reveal - Attachment ]

Slides text up out of a clipped line, piece by piece, as it scrolls into view. Uses GSAP ScrollTrigger and SplitText. Off with reduced motion.

Available options:

  • type words | chars. What the text is split into. Defaults to words.
  • from 'bottom' | 'top'. The side the pieces slide in from. Defaults to bottom.
  • duration A number, seconds each piece takes. Defaults to 0.2.
  • stagger A number, seconds between each piece starting. Defaults to 0.05.
  • ease A string, a GSAP ease such as back.out(2). Defaults to linear.
  • delay A number, seconds to wait after the trigger fires. Defaults to 0.
  • once A boolean. Only play the first time it scrolls into view instead of every time. Ignored with scrub. Defaults to false.
  • scrub A boolean. Tie the animation to the scroll position instead of playing it. Defaults to false.
  • start A string, where the animation starts: an element point and a viewport point, e.g. top 80%. Defaults to top 98%.
  • end A string, where the animation ends, e.g. bottom 60%. Defaults to bottom 2%.
  • markers A boolean. Shows GSAP start and end markers for debugging. Defaults to false.
  • trigger A selector or element to watch for scrolling instead of this one, e.g. a pinned section.

This reveals word by word as it scrolls into view.

This paragraph scrubs through each word across several lines. Lorem ipsum dolor sit amet consectetur adipisicing elit. Error iste corrupti tempora aspernatur, consequatur blanditiis, repellat, quibusdam perferendis sequi dignissimos dolores? Magni, nisi quae.

Split by characters, only the first time it scrolls into view.

This reveals from the top instead of the bottom.

[ Text Scale - Attachment ]

Scales text up from nothing, piece by piece, as it scrolls into view. Each piece grows from its own side, so the text opens up around the middle. Uses GSAP ScrollTrigger and SplitText. Off with reduced motion.

Available options:

  • type words | chars. What the text is split into. Defaults to words.
  • style 'random' | 'linear'. Whether the pieces animate in random order or from first to last. Defaults to random.
  • duration A number, seconds each piece takes. Defaults to 0.25.
  • stagger A number, seconds between each piece starting. Defaults to 0.0125.
  • ease A string, a GSAP ease such as back.out(2). Defaults to linear.
  • once A boolean. Only play the first time it scrolls into view instead of every time. Ignored with scrub. Defaults to false.
  • scrub A boolean. Tie the animation to the scroll position instead of playing it. Defaults to false.
  • start A string, where the animation starts: an element point and a viewport point, e.g. top 80%. Defaults to top 98%.
  • end A string, where the animation ends, e.g. bottom 60%. Defaults to bottom 2%.
  • markers A boolean. Shows GSAP start and end markers for debugging. Defaults to false.
  • trigger A selector or element to watch for scrolling instead of this one, e.g. a pinned section.

Each word scales in from a point that depends on where it sits in the sentence.

This paragraph scrubs word by word as you scroll. Lorem ipsum dolor sit amet consectetur adipisicing elit. Error iste corrupti tempora aspernatur, consequatur blanditiis, repellat, quibusdam perferendis sequi dignissimos dolores? Magni, nisi quae.

Characters scale in, only the first time, over two seconds.

[ Theme Follow - Attachment ]

For anything fixed or sticky: a header, a scroll-to-top button, a toast. While the page scrolls it takes the theme of the surface behind its center, so dark text turns light over a dark section and back again. Mark sections with a surface class; sections added later are picked up. The element gets a data-theme-follow attribute, which sets the theme tokens only (no background), so a transparent element stays transparent. Attach it to the element that is actually positioned. Scroll the page past the demo below to watch the pill change.

Available options:

  • theme-dark A surface that is always dark.
  • theme-light A surface that is always light.
  • theme-invert A surface that is the opposite of the page theme, so it flips with the toggle.
  • no class The element keeps the page theme there.

[ Tilt - Attachment ]

A subtle 3D effect for mouse users: the element tilts toward the pointer. A local version of Vanilla Tilt with no library. It is off with reduced motion and ignores touch.

Available options:

  • reverse A boolean. Flip the direction of the tilt. Defaults to false.
  • max A number, the largest tilt in degrees. Defaults to 15.
  • startX A number, the resting tilt along the x-axis in degrees. Defaults to 0.
  • startY A number, the resting tilt along the y-axis in degrees. Defaults to 0.
  • perspective A number. Lower is more dramatic. Defaults to 1000.
  • scale A number, the scale while hovered for a subtle pop. Defaults to 1.
  • speed A number, milliseconds for the enter and exit transition. Defaults to 300.
  • easing A CSS easing for the enter and exit transition. Defaults to cubic-bezier(.03,.98,.52,.99).
  • transition A boolean. Set false to follow the pointer with no enter and exit transition. Defaults to true.
  • axis x | y. x tilts only left and right, y only up and down. Both axes by default.
  • reset A boolean. Return to the resting tilt when the pointer leaves. Defaults to true.
  • glare A boolean. A light sheen that follows the pointer. Defaults to false.
  • maxGlare A number from 0 to 1, the strongest the glare gets. Defaults to 1.
  • mouseEventElement A selector or element that listens for the pointer instead of the tilted element.

Default

No options at all.

Reversed

A subtle reversed tilt with a glare and a slower transition. It also sets up the 3D pop: give the tilted element transform-style: preserve-3d (always, not only on hover, or the lift snaps flat when the pointer leaves), and transform: translateZ(20px) to the inner elements that should lift.

Dramatic

A bit stronger with a glare, and the tilt does not reset when the pointer leaves.

[ Typing Cycle - Attachment ]

Types a word, deletes it, and moves to the next, forever, like someone at a keyboard. Screen readers get all the words at once. With reduced motion it shows the first word.

Available options:

  • words An array of strings to type, in order. Required.
  • colors An array of CSS colors, one switched to with each word. Variables work.
  • speedIn A number, milliseconds per character typed. Defaults to 120.
  • speedOut A number, milliseconds per character deleted. Defaults to 50.
  • interval A number, milliseconds a finished word stays before deleting. Defaults to 2000.
  • cursor 'caret' | 'underscore' | 'none'. Defaults to caret.
  • delay A number, milliseconds before the first word. Defaults to 0.
  • onScroll A boolean. Starts when the element scrolls into view instead of right away. Defaults to false.

The human senses:

The four seasons:

[ Typing Scroll - Attachment ]

Types the element's text out, character by character, when it scrolls into view. Screen readers get the whole text at once. Off with reduced motion.

Available options:

  • speed A number, milliseconds per character. Defaults to 50.
  • once A boolean. Only types the first time it scrolls into view, instead of every time. Defaults to false.
  • cursor 'caret' | 'underscore' | 'none'. Defaults to caret.
  • delay A number, milliseconds before typing starts. Defaults to 0.

This sentence types itself out each time it scrolls into view, with a blinking caret.

Faster, only the first time, with an underscore cursor and a short delay.

[ Watch Scroll - Attachment ]

Tracks scroll position and direction with data attributes on an element, using one shared listener, so CSS can react. It sets data-scroll-away, data-scroll-down (scrolling down and away from the top), data-scroll-bottom and data-scroll-idle. It is what hides the header as you scroll down.

Available options:

  • awayFromTop A number, the scroll distance in px before data-scroll-away is set. Defaults to 96.
  • nearBottom A number, the distance in px from the page bottom that sets data-scroll-bottom. Defaults to 296.
  • idle A number, milliseconds without scrolling before data-scroll-idle is set. Defaults to 150.
  • threshold A number, how far in px to scroll against the current direction before it flips. 0 flips at once, so even a slow scroll up reveals a hidden header. Defaults to 0.
Current attributes: