@monomonnik Thank you! This got me where I needed to be with my center squares. Now I am having the issue of my two outer squares orbiting around the center, rather than spinning in place.
nFrames = 120
fps = 1/30
rad = 600
size = 100
for n in range(nFrames):
newPage(1920, 1080)
frameDuration(fps)
fill(1)
rect(0, 0, width(), height())
translate(width()/2, height()/2)
t = n * (2 * pi)/nFrames
t2 = -n * (2 * pi)/nFrames
x = rad * cos(t)
y = rad * (sin(2 * t)/2)
scale = 2/(3 - cos(2 * t))
x2 = rad * cos(t)
y2 = rad * (sin(2 * t2)/2)
fill(0, 0, 1)
oval(x - size/2, y - size/2, size, size)
fill(1, 0, 0)
oval(x2 - size/2, y2 - size/2, size, size)
with savedState():
fill(0)
rotate(180 * n/nFrames)
rect(-50, -50, 100, 100)
with savedState():
fill(0)
rotate(-180 * n/nFrames)
rect(-50, -50, 100, 100)
with savedState():
fill(0)
rotate(360 * n/nFrames)
rect(-650, -50, 100, 100)
with savedState():
fill(0)
rotate(360 * n/nFrames)
rect(550, -50, 100, 100)