把Processing中的草图导出为动态gif

http://p5art.tumblr.com/post/76979034572/exporting-sketches-as-animated-gifs-in-processing


Exporting sketches as animated GIFs in Processing

(thanks to my friend aBe from FunProgramming for pointing this out to me)

The stuff applying to animated GIFs on Tumblr that I have written about herestill applies but there’s now a neat library that one can import into a Processing sketch in order to have it create an animated GIF (without having to save the individual GIFs and then convert them manually): gifAnimation.

Personally I use it like this:

- before setup()

import gifAnimation.*;
GifMaker gifExport;

- in setup()

gifExport = new GifMaker(this, “export.gif”);
gifExport.setRepeat(0); // = loop forever

- in draw() (in order to have a GIF with 60 frames)

if (frameCount%2==0 &&  frameCount<121) {
gifExport.setDelay(5); // = speed of the animated GIF
gifExport.addFrame();
}
if (frameCount>121) gifExport.finish();





When I have in my sketch the following:


import gifAnimation.*;


 get ERROR:

The package "gifAnimation" does not exist.  You might be missing a library.


How do I get access to the gifAnimation library?

Go to 

Sketch -> Import Library -> Add Library. 


And look for gifAnimation and install it.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值