Effects
































These examples show layered effects. You draw into off-screen layers, filter them on the GPU, and composite them back with blend modes. They cover filters (filtered(_:) / postProcess(_:)), procedural sources (generate(_:)), previous-frame feedback (withFeedback), the declarative compose { } stack, and the two-input combine path (combined(with:) / aside { }). See the Layered effects reference.
| Example | What it shows |
|---|---|
| Layers | layered effects written both ways: the imperative makeRenderTarget + filtered + drawImage path and the compose { } DSL produce the same frame, and a parameter switches between them |
| FilterCatalog | the whole Filter catalog on one contact sheet over a bundled portrait: a segmented parameter switches between the blur, color & tone, stylize & optical, retro, distortion, and design families |
| FilmLook | a night street as a film still: halation's warm fringe around each lamp and the stock's grain over everything, fresh each frame and heaviest in the mid-tones, with the threshold, radius, tint, and grain on parameters and a compare switch that shows the raw left half (.halation, .filmGrain) |
| InkDrawing | a bundled photograph drawn as pen and ink: the flow-based difference of Gaussians, with the line scale, the cut and its softness, and the flow along each edge on parameters (.xdog) |
| Brushwork | a bundled photograph of a wall of marigolds painted as brushwork: the anisotropic Kuwahara filter, whose paint patches are drawn out along the picture's own flow, with the brush size, its stretch, and its sharpness on parameters (.brushwork) |
| Coherence | a bundled portrait flattened into regions with crisp edges: the coherence-enhancing filter, which smooths along the picture's flow and sharpens across it with a shock, with the rounds, the flow, the reach, and the sign's smoothing on parameters (.shock) |
| Hatching | an engraved landscape under a crossing sun: pen strokes laid along the picture's own flow, as many of them as the tone is dark, with the spacing, the stroke length, how many directions cross, and the two inks on parameters (.hatching) |
| Antialias | the stair-steps in a shader-written layer, smoothed from the image alone and shown split-screen beside the raw layer (.antialias) |
| Relight | a layer read as a height map and lit as an embossed physical material: matte, metal, glass, sand, and liquid (.relight) |
| Glitter | iridescent and glittering shapes: the thin-film .iridescence sheen and the sparkle-fleck .glitter filter, applied per shape with compose { } |
| SoapFilm | the measured spectral pair: .thinFilm interference, whose colors follow the real order a draining soap film passes through, over the streaks of a .diffraction grating |
| GeneratorCatalog | the procedural Generator catalog: the basic patterns, the animated design set, the closed-form fields, and chains where a generated layer passes into filters and blends |
| Cellular | the three styles of the Worley cellular generator (cells, borders, mosaic), with the feature points moving on phase-periodic orbits so the field loops without a seam (.cellular) |
| GaborNoise | Gabor noise, a field whose spectrum is designed: one wavelength, one direction or every direction, a band as narrow as asked, the waves sliding on a loop; the CPU form of the same field reads the crests and dots them (.gaborNoise, GaborNoise) |
| EscapeTime | one escape-time iteration read six ways: the Mandelbrot set and a morphing Julia set colored by escape time, and four orbit traps colored by how close the orbit passes to a shape (.mandelbrot / .julia / .orbitTrap) |
| NewtonBasins | Newton's basins: roots placed on the plane, the method run from every pixel, each pixel colored by the root it lands on and shaded by the steps it took; the roots move along slow orbits so the basins pour, relaxation scales the step, and a dark lake is where the method never lands |
| Feedback | a layer that keeps its previous frame and draws over it: a spiralling feedback tunnel (withFeedback) |
| Fourier | a bundled photograph, its spectrum, and the transform back: draw a shape over the spectrum to filter the picture by scale (.fourier, .spectrum, .inverseFourier) |
| Aside | multi-input effects: a displacement map and a spotlight mask fed into layers (aside { }) |
| FlowStreaks | a grainy picture streaked along a direction field, three ways: a noise layer read as an angle, drifting blobs read along their contours, and their normal map read as vectors (.streaked(along:) / combined(with:.lineIntegralConvolution)) |
| Defocus | depth of field through the two-input combine: a hand-drawn depth map defocuses a layer, and an iris with blades and the catsEye barrel shapes the highlights (combined(with:.defocus)) |
| Dispersion | the chromatic aberration family: the five ways to pull the color channels apart, the spectral tap budget, and a split driven by another layer (.chromaticAberration(mode:) / .disperse) |
| MeshGradient | the mesh-gradient generator: color blobs drift on their own orbits over a domain-warped field |
| DiffusionCurves | a few marks act as fixed color sources, and the color spreads out between them until it settles (.diffuse) |
| DistanceField | the distance field of a layer: at every pixel, how far the nearest edge is and in which direction |
| LayerStyles | a word and two shapes in one layer given an edge of their own under a light that swings: an outline, drop and inner shadows, glows that follow the distance from the edge, and a bevel, alone or stacked (.outline / .dropShadow / .innerShadow / .outerGlow / .innerGlow / .bevel) |
| Light | a room, a lamp that follows the pointer, and the light that reaches every pixel of the room: soft shadows, falloff, beams through a comb, and walls that spill their color back into the room (combined(with:.light)) |
| Droste | a ring of lit windows that repeats inside itself without end: the copies twist into one spiral, and holding the mouse unwinds them to plain rings (.droste(inner:twist:zoom:)) |
| DomainColoring | a complex function colored over the plane it acts on, so you can read its zeros and poles off the color wheels |
| SeamlessClone | a slab of pebbles pasted and cloned onto a photograph of Cozumel at dusk, so the join disappears: the patch keeps its own marks and takes on the color of its surroundings |
| PigmentMix | the same yellow wash over the same blue field, combined as light on one side and as paint on the other: the linear dissolve mixes to gray, while the pigment mix gives green and leaves the unpainted ground alone (.mix / .paintMix) |
| SummedArea | one table that turns the average of any square into four lookups, so a 400-pixel blur costs the same as a 4-pixel one, and each pixel can be thresholded against its own neighborhood instead of one number for the whole page (.boxBlur, .adaptiveThreshold) |
Run one with swift run Example-Effects-<Name>, for example swift run Example-Effects-Layers.