Load GSAP, ScrollTrigger and three.js first
The script reads window.gsap, window.ScrollTrigger and window.THREE. Load all three before code.js. If three never arrives, the section still works with the plain picture swapping out at halfway.
Give it room to scroll
The section is --imd-length tall (300vh by default) with a sticky stage inside. The dissolve runs over the whole length minus one screen, so 300vh means two screens of scrolling. Don't put it inside a parent with overflow: hidden, or the sticky stage stops sticking.
Host the picture with CORS
The canvas can only draw pictures it may read. Same-origin paths always work; a picture on another host needs Access-Control-Allow-Origin.
Shape the dissolve
data-au-noise sets the patch size (higher = smaller, busier), data-au-lean how much the bottom-to-top sweep beats the noise (1 is a straight wipe), and data-au-roughness the grit on the edge. data-au-scrub is how many seconds the dissolve trails the scroll.
Retheme with variables
--imd-bg is what shows through the holes, --imd-fg colours the heading and --imd-muted an optional sentence.
A sentence is optional
It ships with a heading only. To add a line, put <p class="imd_text"> after it in .imd_under (text in React).