Platform
VaultVault
  • Free15
  • Navigation19
  • Buttons9
  • Scroll55
  • Text27
  • Sliders & marquees19
  • Gallery & images67
  • Cursor24
  • Page transitions10
  • Loaders2
  • Backgrounds10
  • UI components33
ButtonsPart of ProButtons
IconsPart of ProIcons
  • Interface Essentials144
  • Social Icons69
  • Payment Badges41
SavedPart of ProSaved
Support
DocumentationDocumentation
MCP serverMCP server
SettingsSettings
VaultButtonsPixel Dissolve Button
Magnetic ButtonBrowse all 182Pixel Hover Nav
  • Free15
  • Navigation19
  • Buttons9
  • Scroll55
  • Text27
  • Sliders & marquees19
  • Gallery & images67
  • Cursor24
  • Page transitions10
  • Loaders2
  • Backgrounds10
  • UI components33
  • Interface Essentials144
  • Social Icons69
  • Payment Badges41
Sign inSign in

Start free. The code for 15 components, no card needed.

Get 15 free

Pixel Dissolve Button

This one is locked. Become a member to open the code for it and the rest of the Vault.

See plansTry the 15 free ones

What you'll need.

Install

    Setup

    npm i gsap

    More like this

    • Pixel
    • Fill
    • SVG

    Features.

    • Hover colour dissolves in pixel by pixel in a stepped 20-frame sweep, then holds solid
    • Leaving dissolves the resting colour back over it, so both directions read as pixels
    • Label and arrow slide to a second copy on hover and snap back on leave
    • Two variants: solid primary and outline
    • The pixel mask is generated by the script: no image to host, nothing to upload
    • No dependencies, no build step
    • Mouse, pen and keyboard focus; touch gets a plain link
    • Respects prefers-reduced-motion: the colour just switches

    How to get it right.

    Keep it 4:1

    The mask is a 24 × 6 grid stretched across the button. At the default 13.6em × 3.4em the cells are square. Change the size by changing font-size on the button, not its width or height, or the cells stretch. A long label widens the button, and the cells with it, rather than clipping.

    Match the outline to your page

    The outline variant's exit sweep paints --pxb-bg. Set it to the colour behind the button, or the last frame flashes the wrong colour.

    Pick an ink that reads on the hover colour

    --pxb-fill is the hover colour and --pxb-ink the text on it. Bright fills want the dark ink (the default); a deep fill such as cobalt #2f55e6 wants --pxb-ink: #ffffff.

    Write the label twice

    The two label spans hold the same text: one slides out, the other in. Change both.

    Pace the sweep

    data-au-frame-duration="30" gives a quick 0.6s sweep that reads as texture. Around 40 the steps start to show, which suits a slower, retro feel; under 20 it reads as a fade.

    Variations.

    • Primary — data-au-variant="primary": amber at rest, pink on hover
    • Outline — data-au-variant="outline": hairline border at rest, fills on hover
    • Sky accent — --pxb-fill: #8fbcf7 for a sky hover on the outline variant
    • On a light page — on a light page set --pxb-bg, --pxb-fg and --pxb-border to your page and text colours, and --pxb-fill: #2f55e6; --pxb-ink: #ffffff

    Where it fits.

    • Hero calls to action — primary and outline side by side
    • Contact or footer link — one large outline button as the last thing on the page
    • Pixel or retro brands — slow the frames down and let the steps show
    • Inside a form — on a <button> instead of the link, same classes and attributes

    Frequently asked.

    Yes. Swap the <a> for a <button type="button"> and keep the classes and attributes; the script doesn't care which element it is.

    The hover only runs on devices with a real pointer. On touch it behaves as a plain link, which is what a tap should do.

    Raise font-size on the button to scale everything together. A different width-to-height ratio works but the cells stop being square.

    No. The script builds it once per page and sets it as --pxb-mask on each button.

    No. It's plain JavaScript and CSS.

    Related components.

    Pro

    Gooey Fan Menu

    Click

    Pro

    Arrow Swap Button

    Hover

    Free

    Rising Fill Button

    Hover