Spirals
Define your own spiral as a function that takes the current radius and returns the current angle in radians
Your function is run for several evenly-distributed radii between 0 and 1. The number of sampled radii increases with time, which leads to interesting animations.
Inspired in part by "The Hypnotic World of Degenerate Spirals"
Functions are defined using a "Reverse Polish Notation" syntax. Here are the different operations it supports:
r
the current radius between 0 and 1n
negate the previous valuem
absolute value of the previous value+
add the previous two values*
multiply the previous two values-
subtract the previous value from the one before it/
divide the previous value from the one before it&
bitwise-and the previous two values|
bitwise-or the previous two values^
bitwise-xor the previous two valuesd
duplicate the previous values
take the sine of the previous valuec
take the cosine of the previous valuee
Raise the second-to-last value to the last valueP
Pi
I use a similar expression format in other places: