097

Fogged Glass Reveal

£5

Look through a rain-covered window into a misty forest. Wipe away soft condensation while refractive beads gather at the edges and rivulets run down the glass.

advanced
4 more details
webgl-shadermask-revealpointer-effectstouch-gestures
Fogged Glass Reveal - GSAP animation effect preview

This demo reads better at your own screen size than in the frame below:

About this effect

A framed window looks out over a misty evergreen forest. Fine condensation softens the view, clear beads catch the landscape and narrow rivulets move down the pane from the moment it opens. A subtle room reflection and recessed frame give the glass a place in the scene.

Read the full effect overview

Drag a finger or mouse across the pane to leave a broad, softly feathered clearing. Displaced beads gather along the stroke and trickle down. Cleared areas persist, with optional re-fog and native Clear glass, Reset and Pause rain controls. The frame and reflection are removable presentation layers.

What's included

12 items
  • A window frame, inset pane, sill and faint room reflection around the forest view
  • Uneven translucent condensation with a smoothly blurred photograph behind it
  • Refractive water beads and moving rivulets from arrival, with narrow wet trails
  • Broad persistent wipes with feathered edges and displaced droplets
  • Direct mouse and touch input, including slow strokes and direction changes
  • Keyboard-operable Clear glass, Reset, Re-fog and Pause rain controls
  • No automatic hand wipe or reveal threshold
  • Tunable brush size, fog strength and droplet motion through data attributes
  • Independent instances with image replacement, clear, reset, wipe and teardown methods
  • Full photograph fallback for reduced motion, no JavaScript and unavailable WebGL
  • Precomputed blur, cached bead textures and bounded portrait moisture surfaces
  • Rendering stops offscreen or in a hidden tab and sleeps when rain is paused

Perfect for

3 use cases
  • Landscape photography and travel campaign covers with a tactile reveal
  • Seasonal editorial features that evoke a view through a rainy window
  • Portfolio photography that visitors uncover at their own pace

How it works

1 section

A WebGL material samples the photograph through a precomputed blur texture and a local condensation mask. Encoded water lenses refract the view; moving drops leave narrow wet paths and collect beads along their descent. Pointer strokes clear moisture and displace water. GSAP manages the motion-preference lifecycle and the explicit Clear glass transition; the renderer manages condensation and droplet movement.

Difficulty Advanced
Includes HTML + JS + CSS source, documentation, AI setup prompt, lifetime updates

Lighthouse, as measured

Google Lighthouse on this effect's demo, 15 September 2026. A measurement of the demo as shipped, not a promise for your page.

Accessibility
100
Best practices
100

No performance score, on purpose. That figure depends on how you deploy: your server's compression and caching, your CDN, the connection and the device doing the test, none of which the code controls. The same page can score very differently on two consecutive runs, so measure it where it will live.

Paid effect

Purchase to unlock the code.

Buying Fogged Glass Reveal opens the HTML, CSS and JavaScript source, the full documentation, an AI setup prompt for your editor, and every update we ship to it. Standard license: unlimited personal and commercial projects.

£5 Standard license, unlimited projects

Browse free effects

Documentation

Quick Start

1. In the HTML head, include the stylesheet and the synchronous availability probe. The probe gives supported browsers a soft photographic loading state; every unavailable-dependency path restores the clear photograph.

Code snippet omitted: it ships with the download.

2. Put this markup in the body. The root must have a nonzero width and height.

Code snippet omitted: it ships with the download.

3. Before closing the body, load GSAP, then import three.js and append the effect script. Keep the failure handlers: an inaccessible CDN must leave the image usable. The included demo also preloads the three.js module, its core module and the effect script in the head so their requests overlap; the first pane adopts the head probe’s canvas and context at mount. Failure handlers release the pending context.

Code snippet omitted: it ships with the download.

Already using three.js? Reuse your existing module and assign it to window.THREE before loading this classic script; do not load a second copy or use the discontinued UMD build. The script automatically mounts every [data-fogged-glass] root when the DOM is ready.

Using It With Your Own Design

Markup contract: each [data-fogged-glass] needs a [data-glass-source] containing one image. Controls are optional and are selected by their documented data attributes, within that root. Put essential text and links above the canvas; access to important content must never depend on wiping.

Demo styling: the forest photograph, Mona Sans type, cue and full-viewport size are replaceable. .glass__frame contains the decorative mullion and sill; .glass__reflection adds a faint room reflection. Remove those elements for a full-bleed, unframed pane and position your own controls. The renderer does not select or depend on them. No particular text or decorative class is required by the script.

Required CSS: the root needs position: relative, a defined height and overflow: hidden; the canvas and source fill it. Preserve the is-live and is-fallback rules. The source remains available for no JS, failed dependencies, reduced motion and unavailable WebGL. Keep controls above the canvas and retain a visible focus indicator. touch-action: none lets a finger wipe in every direction; reserve this setting for a deliberate interactive stage inside a scrollable page.

Options

Attribute Values Default Description
data-brush 20–120 54 Wipe radius in CSS pixels
data-fog 0–1 0.96 Strength of the condensed layer
data-refog 0, 1 0 Whether cleared moisture gradually returns

data-drop-motion="0" freezes rain and droplet movement for still captures; the default is 1. Use setDropMotion(false) or the Pause rain control to pause it after mount. Pause retains the current wet trails and lets the visitor keep wiping. data-preserve-buffer="1" retains WebGL pixels for a custom canvas export; it is off by default and automatically enabled for [data-thumbnail-target].

Options are read at mount. Use setRefog() to change re-fog while mounted. Explicit zero values are supported. Rivulets move from arrival, but there is no automatic hand wipe or coverage threshold. Clear glass removes all moisture and keeps the scene clear until Reset, including when Re-fog is selected.

Accessibility

Native buttons support Enter and Space; the checkbox supports Space. Pause rain stops autonomous droplet motion and updates its pressed state and label. The canvas is decorative and hidden from assistive technology. The source image keeps its alternative text, and meaningful DOM copy is never erased. The controls have visible focus styles and do not capture pointer drags.

Touch is the primary mobile interaction, with a brush measured in CSS pixels. On reduced-motion systems, the clear source photograph is shown without a canvas or inactive controls. The same usable photograph appears without JavaScript, with blocked dependencies or without WebGL. Changing the motion preference tears down or remounts the scene.

Choosing Your Images

Pick a landscape with fine, visible detail near the centre: trees, distant buildings or a mountain edge make a wiped trail easy to read. Large areas of empty sky have little detail to uncover. The source is cover-fitted without distortion; check both landscape and portrait crops, especially if your subject sits near an edge. A 1920–2048px image is enough for a full-bleed stage in most layouts.

The shipped forest and lake are Pexels photographs, baked locally through the image manifest. Source files: misty forest, Pexels photo 10762369 and Diablo Lake by Alannah Cavanaugh, Pexels photo 32837501. See the Pexels licence. The manifest records the original URLs alongside the committed local masters. Their stock-library IDs are land-forest and land-diablo-lake. The alternate lake is included to demonstrate that the effect works with a different subject and contrast range.

Browser Support

Requires a modern browser with WebGL, ES modules/import maps, Pointer Events and ResizeObserver. Current Chrome, Edge, Firefox and Safari support this setup. Browsers without those graphics capabilities receive the source image. A production page must permit its selected CDN in its Content Security Policy, or self-host the same dependencies.

Performance

Rendering stops while offscreen or when the tab is hidden, and sleeps when rain is paused and re-fog is off. Pixel ratio is capped at 1.5 on fine pointers and 1.25 on coarse pointers. The moisture surfaces cap their longest edge at 768px, including portrait layouts. The background blur is baked once per image instead of sampled repeatedly every frame; stationary beads reuse a cached layer. The first pane adopts the head probe’s WebGL context instead of discarding it and allocating another, and normal rendering does not preserve its drawing buffer. To reduce cost further, lower the pixel ratio cap first. The moisture surfaces retain normalized wipes across resizes. Removal of the root and revert() both release the WebGL context.

Dependencies

Dependency Role
GSAP 3.12+; demo pinned to 3.15.0 Motion-preference lifecycle, scoped teardown and the explicit Clear glass transition
three.js 0.180.0 WebGL material, textures and rendering

No GSAP plugins or Lenis are required. Droplet movement and condensation shading are handled by the effect's own renderer, not GSAP.

Worked examples, the events and programmatic API, and the class reference ship with the download, alongside the full source.

Your cart

Your cart is empty

The Vault £99

The Vault library, plus future additions to the library.