WarpSpec

class WarpSpec(field: String, val calmAmount: Float = 0.04f, val livelyAmount: Float = 0.11f, val drift: Float = 0.0f)

How the previous frame is bent before it is laid back down.

This is the piece that separates a smear from a trip. The feedback loop brings the last frame back scaled and turned, which is enough to make a mark grow its own echo. But scaling and turning are the only two things a whole picture can be put through at once, so every drawing built on the loop ends up doing one of the same two things.

Asking per pixel removes that limit. Each pixel of the new frame works out where in the old one it came from, and that answer can be anything: a twist that tightens away from the middle, ripples travelling outward, a lens, a flow read from noise. The picture keeps folding through that shape, frame after frame, and grows detail nobody drew.

field is a piece of SkSL declaring one function, which is handed a position in the range roughly minus one to one and answers how far to shift. Everything in the shared library is available inside it, including the spectrum, so the shape can answer the music:

float2 warpField(float2 uv) {
return float2(-uv.y, uv.x) * (0.4 + uBass);
}

A field that needs more than the music reads uWarpParams, four numbers the drawing sets in params every frame: where a second well is, what constant a fractal uses, and so on.

Constructors

Link copied to clipboard
constructor(field: String, calmAmount: Float = 0.04f, livelyAmount: Float = 0.11f, drift: Float = 0.0f)

Properties

Link copied to clipboard

How hard the bend is in calm music.

Link copied to clipboard

How fast the echoes turn their hue as they age, in radians a second. The turn is made in OKLab, so an echo keeps its brightness while its colour moves on. Zero leaves colours alone.

Link copied to clipboard

And in lively music. Small numbers go a long way, because it happens every frame.

Link copied to clipboard

A multiplier on both amounts, for a setting a person can turn up or down.

Functions

Link copied to clipboard
fun amount(mood: Float): Float