处理GenArt |如何将形状保存为GIF



目标:将此输出导出为GIF。

这是使用Processing和Python的工作代码。

这实际上是永远运行的,我如何在一段时间后停止它,以便保存为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

请让我知道,如果还有什么其他我应该添加到帖子。

你不能。处理中不支持GIF。但是,您可以使用saveFrame()来保存编号的图像序列。只需在draw结束时调用saveFrame()。有许多工具可以从图像列表中创建GIF。

最新更新