So many of my sketches begin with the same function: producing a uniform distribution of values along an array, between [0..1] range. Here's how it looks in JavaScript.
I'm calling it "arcs" (for arc lengths) but perhaps there is a proper name for this sort of thing?
I use this for all sorts of things, like generating an N-sided polygon:
Or distributing N points evenly along a line segment:
Or just making a wavy horizontal line with noise.
Various outputs from the scribble function.
Using a higher dimension noise function (4D) and a walking along the parametric equation of a torus, you can get some interesting dancing motion that loops seamlessly.
Here's another variation using a different random seed.
Code for that...
Drawing out.
(Thanks @slowkow for the idea! Didn't realize how neat it looks while drawing out.)
Drawing out while walking along the torus, and shifting hues.
• • •
Missing some Tweet in this thread? You can try to
force a refresh
Linear interpolation (sometimes called 'lerp' or 'mix') is a really handy function for creative coding, gamedev and generative art.
The function interpolates within the range [start..end] based on a 't' parameter, where 't' is typically within a [0..1] range.
A thread...
For example, divide 'loop time' by 'loop duration' and you get a 't' value between 0..1.
Now you can map this 't' value to a new range, such as `lerp(20, 50, t)` to gradually increase a circle's radius, or `lerp(20, 10, t)` to gradually decrease its line thickness.
Another example: you can use linear interpolation to smoothly animate from one coordinate to another. Define a start point (x1, y1) and end point (x2, y2), then interpolate the 'x' and 'y' dimensions separately to find the computed point in between.