home/ atoms/ generative-sketch-parameterization

Extracting magic numbers into named variables makes a generative sketch explorable by tuning

The progression from ch1_listing_i1v00 to ch1_listing_i1v02 demonstrates systematic parameterization: the first sketch has literal numbers embedded in the code (height/8, +=0.02, noiseFactor * 26); the second introduces div, scale, noiseAmt, and grid as named float variables at the top of the file. With named parameters, a learner can explore the parameter space by changing one number and re-running without hunting through the code. This is the core practice loop for generative art: parameterize → tune → observe → repeat. The same principle recurs throughout the repo: Spiral2–Spiral6 vary the angle-step parameter to explore the family of spiral forms.

Examples

ch1_listing_i1v02.pde declares float div = 2; float scale = 20; float noiseAmt = 0.01; int grid = 5; at the top instead of embedding these values in the nested loop. ch4_1_2_Spiral3.pde exposes radiusIncrement and stepIncrement and animates step via step += stepIncrement each frame.

Assessment

Look at ch1_listing_i1v00.pde and identify three literal values that are candidates for extraction into named parameters. Explain what visual property each controls.

“float div = 2; float scale = 20; float noiseAmt = 0.01; int grid = 5;”
corpus · generative-art-code-examples-josephfiola-genart-processing-p · chunk 5
“float radiusIncrement = 10.0; float step = 0.0; float stepIncrement = 0.15;”
corpus · generative-art-code-examples-josephfiola-genart-processing-p · chunk 38