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:
variantfade | up | down | left | right | scale. Defaults toup.onceA boolean. Animate in only the first time (default), or replay each time it re-enters the viewport withfalse.delayA number, seconds to wait before animating in.durationA number, seconds the transition lasts.staggerA number, seconds between each child. When set, the element's children animate in one after another.triggerA string, a selector for another element that triggers the animation.offsetA number, the percent of the viewport height the element must clear from the bottom edge. Defaults to2.
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 toright.
[ 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:
messageA string shown inside the cursor.iconAn icon name fromstatic/icons, ortruefor the cursor's default icon.iconSizesm | md | lg. Defaults tosm.iconColorAny CSS color for the icon.imageA picture path shown inside the cursor, e.g./images/img-sample-1.jpg.imageLayerfront | behind. Whether the picture sits over the cursor's message and icon or under them. Defaults tobehind.iconSwapA second icon name the cursor swaps to each time the element is clicked, e.g. play and pause.variantA string, the name of a look defined in<MouseCursor variants>.tiltA 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; passfalseto 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.
[ 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:
childA selector inside the field, or an element. Defaults to the first child.easeease | spring | instant. Defaults toease.followSpeedA number from 0 to 1, how quickly the child follows the pointer. Defaults to0.08.returnSpeedA number from 0 to 1, how quickly the child returns to the center. Defaults to0.06.bounceA number from 0 to 1, how bouncy aspringis. Defaults to0.6.tiltA 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 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:
targetA selector, an element, or a function that returns one. The element the cursor sits on.variantA string, the name of a look defined in<MouseCursor variants>while snapped.evententer | move. Snap as soon as the pointer enters, or on the first movement over it. Defaults tomove.
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:
fromtop | center | bottom. The edge the element pivots from. Defaults totop.triggerA selector or element to watch for scrolling instead of the flipped element itself.startA string, the scroll position the effect starts at (element point, viewport point). Defaults totop 98%.endA string, the scroll position it ends at. Defaults tobottom top.scrubA boolean. Tie the tilt to scroll position instead of playing the swing. Defaults tofalse.easeA GSAP-style name such asback.out(2)orelastic.out(1, 0.4), or a function. Only used while scrubbing. Defaults tonone.onceA boolean. Only swing the first time it comes into view. Ignored while scrubbing.
[ 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:
blurA number, the blur radius in px. Browsers without refraction only. Defaults to12.saturateA number, saturation in percent. Browsers without refraction only. Defaults to140.scaleA number, refraction strength in px. Chromium only. Defaults to40.tintdarkfor a darker tint over light content, or any CSS color.
[ 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:
wordsAn array of strings, the words to cycle through in order. Required.colorsAn array of colors (any CSS color, including variables) to fade to along with each word.intervalA number, milliseconds between each word. Defaults to2000.charsA GSAP preset (upperCase | lowerCase | upperAndLowerCase) or your own string of characters to scramble through.monoA boolean. Use the mono-spaced font. Defaults totrue.
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:
newTextA string. Scramble into this text on hover, and back to the original on leave.outA boolean. Also scramble when the pointer leaves or focus moves away. Always on withnewText. Defaults tofalse.targetA selector inside the element, or an element, whose text scrambles. Defaults to a.label(as in Button), else the element itself.charsA GSAP preset or your own string of characters to scramble through.durationA number, seconds the effect lasts. Defaults to0.5.revealDelayA number, seconds between each character settling. Defaults to0.125.
[ Glitch Scroll - Attachment ]
Scrambles text each time it scrolls into view. Scroll up and down to replay.
Available options:
charsA GSAP preset or your own string of characters to scramble through.revealDelayA number, seconds between each character settling. Defaults to0.05.durationA number, seconds the effect lasts. Defaults to0.75.onceA boolean. Only scramble the first time it scrolls into view. Defaults tofalse.triggerA selector or element to watch instead of this element, e.g. a pinned section.startA string, the scroll position the effect starts at. Defaults totop 98%.endA string, the scroll position it ends at. Defaults tobottom 2%.monoA boolean. Use the mono-spaced font. Defaults totrue.
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:
targetA selector, an element, or a function that returns one. The element whose text scrambles. Required.charsA GSAP preset or your own string of characters to scramble through.durationA number, seconds the effect lasts. Defaults to0.75.revealDelayA number, seconds between each character settling. Defaults to0.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:
widthA number, the border width in px. Defaults to1(3when animated).angleA number, the gradient angle in degrees. Defaults to135.colorAny CSS color, including variables.lengthshort | long. How much of the border the gradient covers.animatetruesweeps around the element forever;'hover'reveals it on hover.durationA number, seconds per sweep. Defaults to2.5.rayTraceA boolean. A glow that follows the pointer. Give the element its own background.
Static
gradient border
gradient border
gradient border
Animated
Ray tracing
[ Grid Fade - Attachment ]
A grid of tiles over an element that fades away, or away and back, as it scrolls into view.
Available options:
typein | in-out. Fade the tiles away, or away and back. Defaults toin.sizesm | md | lg. The tile size. Defaults tomd.sequencerandom | linear | circular. The order tiles fade: shuffled, left to right, or outward from the center. Defaults torandom.scrubA boolean. Tie the fade to scroll position instead of playing it. Defaults totrue.onceA boolean. Only play the first time. Applies whenscrubisfalse.durationA number, seconds the fade lasts. Applies whenscrubisfalse. Defaults to1.5.startA string, the scroll position the fade starts at. The default depends ontypeandscrub.endA string, the scroll position it ends at. The default depends ontypeandscrub.

[ 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:
xA number, the horizontal pull as a fraction of the pointer's distance from the center. Defaults to0.5.yA number, the vertical pull. Defaults to0.5.followDurationA number, milliseconds the element takes to catch up to its target. Defaults to640.followEaseA CSS easing for catching up. Defaults to the site's easing.returnDurationA number, milliseconds the target takes to travel back. Defaults to220.returnEasecubic-bezier(...),linear,ease,ease-outorease-in-out. Values above 1 overshoot. Trycubic-bezier(0, 1.64, 0.63, 1.92)for a bounce.
[ 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 tofibers.opacityA number from 0 to 1. Defaults to0.1.colorAny CSS color. Defaults to the text color, so it follows the theme.sizeA number, pixels before the noise tile repeats. Defaults to480.
[ 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:
fromA number, the starting offset as a percent of the element's height. Defaults to-5.toA number, the ending offset. Defaults to5.

[ 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:
strengthA number, the sensitivity of the push (how far the element moves). Defaults to10.restoreA number from 0 to 1, how quickly the element settles back. Lower is slower. Defaults to0.1.maxRotateA number, the most rotation in degrees the push adds. Use0to remove the effect. Defaults to25.
Basic example on text.

[ 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:
splitchars | words | whole. What rolls: each letter, each word, or everything in the target at once, which works on icons and any markup. Defaults tochars.fromstart | end | center | edges | random. Where the roll begins, forcharsandwords:centerrolls outward andedgesrolls inward.randompicks a new order on every hover. Defaults tostart.directionup | 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 toup.rewindA boolean. By default the roll plays backward when the pointer leaves. Withfalseit never rolls back: every time the pointer or keyboard focus arrives it rolls on to the next copy, always the same way. Defaults totrue.staggerA number, seconds between each piece starting. Defaults to0.02.durationA number, seconds each piece takes. Defaults to0.6.targetA 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'.paddingA number, how far the circle sits out from the element, in em. Defaults to0.4.scaleA number that multipliespaddingfor a circle:1.2draws the loop farther out,0.8closer in. Defaults to1.curveFor an underline: a preset, or acubic-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 ayof 1 is the top and 0 the bottom.hoverA boolean. Draws the scribble in on hover and keyboard focus instead of showing it from the start. Defaults tofalse.scrollA 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 tofalse.startForscroll: a ScrollTrigger-style start, the element's point then the viewport's, such as'top 85%'(the default) or'bottom center'.endForscroll: a ScrollTrigger-style end. Withonce: falsethe scribble resets past it. Defaults to'bottom 2%'.onceForscroll:truedraws it the first time only (the default).falsedraws it each time it scrolls into view and resets when it leaves.triggerForscroll: a selector or element to watch for scrolling instead of this element, such as a whole section.markersForscroll: a boolean that shows GSAP's start and end markers for debugging. Defaults tofalse.thicknessA 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 to0.35.roughA number from 0 to 1. How ragged the edges are: they wobble and get chipped in places, like spray paint or a dry brush.0is smooth. Defaults to0.5.streaksA number, how many thin dry streaks are left bare inside the line, like bristles that ran out of paint.0is solid. Defaults to0.seedA number. The same seed draws the same line every time. Without one, every line is different.colorA string, any CSS color. Defaults to the accent. Also set with--scribble-color.heightA 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 to0.7em.offsetA 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:
viewportA selector inside for the box the row slides across. Defaults to[data-slide-viewport].trackA selector inside for the row that slides. Defaults to[data-slide-track].mediaA media query. Outside it nothing is pinned. Defaults to(min-width: 1024px); useallfor every size.scrubA number, seconds the row takes to catch up with the scroll. Defaults to1.parallaxA selector for elements inside the row that drift sideways as it slides, such as images in frames.parallaxAmountA number, how far they drift as a percent of their own width. Defaults to25.
[ 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:
radiusA number, how strongly the text curves. Positive bends it like a smile, negative like a frown, and larger numbers curve it more. Defaults to1.kerningA number, extra pixels between characters. Defaults to0.centeredA boolean. Shifts the text so the arc is centered in the element instead of sitting along its top or bottom. Defaults tofalse.spin'right' | 'left'. Rotates the element forever, clockwise or counter-clockwise.spinDurationA number, seconds per turn. Defaults to10forrightand12forleft.
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:
typewords | chars. What the text is split into. Defaults towords.style'random' | 'linear'. Whether the pieces animate in random order or from first to last. Defaults torandom.durationA number, seconds each piece takes. Defaults to0.25.staggerA number, seconds between each piece starting. Defaults to0.0125.easeA string, a GSAP ease such asback.out(2). Defaults tolinear.onceA boolean. Only play the first time it scrolls into view instead of every time. Ignored withscrub. Defaults tofalse.scrubA boolean. Tie the animation to the scroll position instead of playing it. Defaults tofalse.startA string, where the animation starts: an element point and a viewport point, e.g.top 80%. Defaults totop 98%.endA string, where the animation ends, e.g.bottom 60%. Defaults tobottom 2%.markersA boolean. Shows GSAP start and end markers for debugging. Defaults tofalse.triggerA 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:
durationA number, seconds each piece takes. Defaults to1.onceA boolean. Only play the first time it scrolls into view instead of every time. Ignored withscrub. Defaults tofalse.scrubA boolean. Tie the animation to the scroll position instead of playing it. Defaults totrue.startA string, where the animation starts: an element point and a viewport point, e.g.top 80%. Defaults totop 90%.endA string, where the animation ends, e.g.bottom 60%. Defaults tobottom 60%.markersA boolean. Shows GSAP start and end markers for debugging. Defaults tofalse.triggerA 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:
typewords | chars | lines. What the text is split into. Defaults towords.from'top' | 'center' | 'bottom'. The edge the pieces tip forward from. Defaults totop.durationA number, seconds each piece takes. Defaults to1.staggerA number, seconds between each piece starting. Defaults to0.05.easeA string, a GSAP ease such asback.out(2). Defaults topower2.out.onceA boolean. Only play the first time it scrolls into view instead of every time. Ignored withscrub. Defaults tofalse.scrubA boolean. Tie the animation to the scroll position instead of playing it. Defaults tofalse.startA string, where the animation starts: an element point and a viewport point, e.g.top 80%. Defaults totop 98%.endA string, where the animation ends, e.g.bottom 60%. Defaults tobottom 2%.markersA boolean. Shows GSAP start and end markers for debugging. Defaults tofalse.triggerA 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:
typewords | chars. What the text is split into. Defaults towords.durationA number, seconds each piece takes. Defaults to0.6.staggerA number, seconds between each piece starting. Defaults to0.08.easeA string, a GSAP ease such asback.out(2). Defaults topower3.out.travelA number, seconds the text takes to travel to its place. Defaults to1.2.travelEaseA GSAP ease for the travel. Defaults topower3.inOut.holdA number, seconds to wait before the travel starts. Defaults to0.15.delayA number, seconds to wait before anything starts, e.g. for a loader to lift. Defaults to0.
[ 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:
typewords | chars. What the text is split into. Defaults towords.from'bottom' | 'top'. The side the pieces slide in from. Defaults tobottom.durationA number, seconds each piece takes. Defaults to0.2.staggerA number, seconds between each piece starting. Defaults to0.05.easeA string, a GSAP ease such asback.out(2). Defaults tolinear.delayA number, seconds to wait after the trigger fires. Defaults to0.onceA boolean. Only play the first time it scrolls into view instead of every time. Ignored withscrub. Defaults tofalse.scrubA boolean. Tie the animation to the scroll position instead of playing it. Defaults tofalse.startA string, where the animation starts: an element point and a viewport point, e.g.top 80%. Defaults totop 98%.endA string, where the animation ends, e.g.bottom 60%. Defaults tobottom 2%.markersA boolean. Shows GSAP start and end markers for debugging. Defaults tofalse.triggerA 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:
typewords | chars. What the text is split into. Defaults towords.style'random' | 'linear'. Whether the pieces animate in random order or from first to last. Defaults torandom.durationA number, seconds each piece takes. Defaults to0.25.staggerA number, seconds between each piece starting. Defaults to0.0125.easeA string, a GSAP ease such asback.out(2). Defaults tolinear.onceA boolean. Only play the first time it scrolls into view instead of every time. Ignored withscrub. Defaults tofalse.scrubA boolean. Tie the animation to the scroll position instead of playing it. Defaults tofalse.startA string, where the animation starts: an element point and a viewport point, e.g.top 80%. Defaults totop 98%.endA string, where the animation ends, e.g.bottom 60%. Defaults tobottom 2%.markersA boolean. Shows GSAP start and end markers for debugging. Defaults tofalse.triggerA 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-darkA surface that is always dark.theme-lightA surface that is always light.theme-invertA surface that is the opposite of the page theme, so it flips with the toggle.no classThe element keeps the page theme there.
<div {@attach themeFollow()}>…</div>
<section class="theme-light">…</section>[ 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:
reverseA boolean. Flip the direction of the tilt. Defaults tofalse.maxA number, the largest tilt in degrees. Defaults to15.startXA number, the resting tilt along the x-axis in degrees. Defaults to0.startYA number, the resting tilt along the y-axis in degrees. Defaults to0.perspectiveA number. Lower is more dramatic. Defaults to1000.scaleA number, the scale while hovered for a subtle pop. Defaults to1.speedA number, milliseconds for the enter and exit transition. Defaults to300.easingA CSS easing for the enter and exit transition. Defaults tocubic-bezier(.03,.98,.52,.99).transitionA boolean. Setfalseto follow the pointer with no enter and exit transition. Defaults totrue.axisx | y.xtilts only left and right,yonly up and down. Both axes by default.resetA boolean. Return to the resting tilt when the pointer leaves. Defaults totrue.glareA boolean. A light sheen that follows the pointer. Defaults tofalse.maxGlareA number from 0 to 1, the strongest the glare gets. Defaults to1.mouseEventElementA selector or element that listens for the pointer instead of the tilted element.
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:
wordsAn array of strings to type, in order. Required.colorsAn array of CSS colors, one switched to with each word. Variables work.speedInA number, milliseconds per character typed. Defaults to120.speedOutA number, milliseconds per character deleted. Defaults to50.intervalA number, milliseconds a finished word stays before deleting. Defaults to2000.cursor'caret' | 'underscore' | 'none'. Defaults tocaret.delayA number, milliseconds before the first word. Defaults to0.onScrollA boolean. Starts when the element scrolls into view instead of right away. Defaults tofalse.
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:
speedA number, milliseconds per character. Defaults to50.onceA boolean. Only types the first time it scrolls into view, instead of every time. Defaults tofalse.cursor'caret' | 'underscore' | 'none'. Defaults tocaret.delayA number, milliseconds before typing starts. Defaults to0.
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:
awayFromTopA number, the scroll distance in px beforedata-scroll-awayis set. Defaults to96.nearBottomA number, the distance in px from the page bottom that setsdata-scroll-bottom. Defaults to296.idleA number, milliseconds without scrolling beforedata-scroll-idleis set. Defaults to150.thresholdA number, how far in px to scroll against the current direction before it flips.0flips at once, so even a slow scroll up reveals a hidden header. Defaults to0.