【发布时间】:2014-04-03 03:50:07
【问题描述】:
我想将我的一个处理草图导出为 gif 格式,并使用 extrapixel 的 Gif 动画库 (http://extrapixel.github.io/gif-animation/) 来执行此操作。
我能够导出正确数量的帧,但它们似乎都是空的。
任何想法为什么会发生这种情况?
import gifAnimation.*;
GifMaker gifExport;
float angle = 0.1;
void setup() {
size(500, 500);
smooth();
noStroke();
background(0);
frameRate(12);
gifExport = new GifMaker(this, "spin rect sine growth.gif");
gifExport.setRepeat(0); // make it an "endless" animation
gifExport.setTransparent(255); // make white the transparent color -- match browser bg color
}
void draw() {
float size = map(sin(angle),-1,1,0,height);
rectMode(CENTER);
translate(width/2, height/2);
rotate(angle);
noStroke();
fill(255,255);
rect(0,0, size, size);
angle += 0.0523 ;
noStroke();
fill( 0, 15);
rect(0, 0, width, height);
gifExport.setDelay(0); //maybe no delay?
gifExport.addFrame();
if (frameCount == 120) gifExport.finish();
}
【问题讨论】:
-
我觉得我应该为在使用特定库时提出问题而道歉——这可能会使我的整个帖子过于具体。如果是这样,我很抱歉
-
当你说出现空,你的意思是白色吗?在白色背景上?
-
你为什么使用
gifExport.setDelay(0);?你不想在 gif 的帧之间有一点延迟吗? -
我很尴尬地承认我只包含
gifExport.setDelay(0)是为了模仿库中包含的示例代码。
标签: animation export processing gif