img
p5.Image
Stores the loaded image data that will be warped and displayed. Created in preload() and read in draw()
let img; // declared globally, assigned in preload()
mic
p5.AudioIn
Represents the microphone input device. Started when the user clicks, then continuously captures audio
let mic; // declared globally, initialized in setup()
amplitude
p5.Amplitude
Analyzes the microphone audio to extract the overall volume level (0.0 to 1.0) each frame
let amplitude; // declared globally, initialized in setup()
level
number
Holds the current amplitude reading from the microphone (0.0 = silent, 1.0 = loudest) in each frame
let level = amplitude.getLevel();
timeFactor
number
A time-based oscillation value that ranges from -1 to 1, creating continuous pulsing independent of audio
let timeFactor = sin(frameCount * 0.05);
morphCenterX
number
The X-coordinate of the warp effect's center, which follows the mouse cursor
let morphCenterX = mouseX;
morphCenterY
number
The Y-coordinate of the warp effect's center, which follows the mouse cursor
let morphCenterY = mouseY;
baseRadius
number
The radius of the circular warp zone in pixels, controlled by mouse X position (50 to 300)
let baseRadius = map(mouseX, 0, width, 50, 300);
morphFactor
number
The combined strength of the warp effect (-0.7 to 0.7), blending audio reactivity and time oscillation
let morphFactor = audioMorphFactor + timeMorphFactor;
dist
number
The Euclidean distance from the current pixel to the warp center, used to determine if it's in the warp zone
let dist = sqrt(dx * dx + dy * dy);