Wobbling Rect


by Zevan Rosser

This series of related equations meld together a variation on a superellipse and a few simplified sine/cosine waves.


Calculate the values for $a, b, c, d$ and $s$:

$$ a = w (|\cos \theta| \cos \theta + |\sin \theta| \sin \theta ) $$
$$ b = h (|\cos \theta| \cos \theta - |\sin \theta| \sin \theta ) $$
$$ c = w \cos(\theta 3 + t) $$
$$ d = h \sin(\theta 3 + t) $$
$$ s = n * \cos(\theta 6) $$

Use the waves as weights and the rectangle as an offset to give $x$ and $y$ coordinates.

$$ x = c n s + a $$
$$ y = d n s + b $$

Where $w$ is the width of the rectangle, $h$ is the height of the rectangle, $n$ contributes to the intensity of the waves and $t$ is the parameter to oscillate waves $c$ and $d$.

Increment $t$ over Time

In the above plot $t$ is incremented over time resulting in the animation you see. Here is a grid showing $t$ at different values:

Values for $t$ in the above are random, ranging from 0 to 10.