Skip to content

Instantly share code, notes, and snippets.

@WashingtonGold
Last active March 14, 2022 21:34
Show Gist options
  • Save WashingtonGold/1af3d00a29de4c14f3a786e339048724 to your computer and use it in GitHub Desktop.
Save WashingtonGold/1af3d00a29de4c14f3a786e339048724 to your computer and use it in GitHub Desktop.
for row in range(w):
for col in range(h):
cx = 1.5*(row - 3*w/4)/(0.5*w)
cy = 1.0*(col - h/2)/(0.5*h)
c = complex(cx, cy)
x = complex(0, 0)
for i in range(iterations):
if abs(x) > 4: break
x = x**2 + c
color = (i << 21) + (i << 10) + i * 8
pixels[row,col] = color
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment