While trying to implement noise on a 2D shape, our experiments led us to create our first community generated function!

Big thanks to @mimetikmusic for helping us tease out the math needed to apply some noise to the edges of our shape function (aka distance function) in order to create some satisfyingly wiggly borders.

Henceforth known as the wiggly noise effect 🔥🔥🔥 — here is the function:

/* 
* WIGGLY
* - authored with the math help by @mimetikmusic -
* (cx) centerPoint in the x axis
* (cy) centerPoint in the y axis
* (freq) frequency of the wobble
* (mag) magnitude of the wobble
* (sp) spread of the wobble 
* returns => wiggly noise
*/

float wiggly(float cx, float cy, float mag, float freq, float sp) {
    float w = sin(cx * mag * freq * PI) * cos(cy * mag * freq * PI) * sp;
    return w;
}