我想将我的一个Processing草图导出为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 …Run Code Online (Sandbox Code Playgroud) 这是一项家庭作业.
我提示用户输入任意数量的数字,然后输入一个单词.因为我不知道将输入的数字量,我将它们存储在String []中,然后将它们移动到ArrayList.
我通过在白色空间分割扫描仪输入将输入正确存储到String []中.
现在我尝试使用以下内容将String []的内容添加到ArrayList中:
int i = 0;
for ( i = 0; i < inputToStringArray.length; i++) {
if(values.add(Double.parseDouble(inputToStringArray[i]))){ //if you can parse a double, parse a double
values.add(Double.parseDouble(inputToStringArray[i]));
}
}
Run Code Online (Sandbox Code Playgroud)
因为我不希望输入结尾的单词,我正在解析String []为双精度.
问题是,ArrayList复制每个数字,连续两次存储它.
输入1,2.2,3.3将存储为1.0,1.0,2.2,2.2,3.3,3.3.
为什么?