THREE.ShaderMaterial takes two strings: vertexShader and fragmentShader. The vertex shader runs once per vertex to decide the screen position (gl_Position); the fragment shader runs once per rasterized pixel to decide its color (gl_FragColor). Pass values between the two with varying (or in/out) variables.
The channel for JS to hand values into GLSL is a uniform — think of it as a global that every vertex and pixel reads the same value from. The demo drives flowing stripes and a swirl purely from one uniform float uTime, computed with sin() inside the fragment shader.
Attributes like position, normal, uv, and matrices like modelViewMatrix and projectionMatrix are injected automatically by three.js — you don’t declare them yourself. Declaring them again actually causes a duplicate-declaration error.
When to use
For a distinctive look no built-in material can produce, procedural patterns, or data-visualization shaders.