Goal: export this output as a GIF.
This is working code, using Processing and Python.
This actually runs forever, how do I stop it after a while so as I can save as GIF?
import random
radius = 0
def setup():
global displayWidth, displayHeight, radius
size(displayWidth, displayHeight)
background(0)
noFill()
stroke(255, 25)
radius = height / 2
def draw():
global radius
center_x = width / 2
center_y = height / 2
beginShape()
for i in range(360):
_noise = noise(i * 0.02, float(frameCount) / 50)
x = center_x + radius * cos(radians(i)) * _noise
y = center_y + radius * sin(radians(i)) * _noise
curveVertex(x, y)
if radius == 0:
stroke(225, 0, 0, 10)
if radius == 100:
stroke(0, 225, 0, 25)
if radius == 200:
stroke (0, 0, 225, 25)
endShape(CLOSE)
radius -= 1
Please let me know if there is anything else I should add to post.
You can't. GIFs are not supported in processing. However you can use saveFrame()
to saves a numbered sequence of images. Just call saveFrame()
at the end of draw
. There are numerous tools that can create a GIF from a list of images.