Processing 存储框架可以';无法在处理过程中跟上帧速率
我正在使用saveFrame创建一个图像序列以引入后期效果。在每一个循环中,我都会提高帧率——我肯定这不是最好的方法。在每次循环结束时,我都会保存帧,但saveFrame无法跟上我试图保存的逐渐提高的帧速率。有没有人知道如何在不提高帧速率的情况下实现我想要的效果,这样saveFrame就可以跟上进度?这是我的密码:Processing 存储框架可以';无法在处理过程中跟上帧速率,processing,frame-rate,processing.js,Processing,Frame Rate,Processing.js,我正在使用saveFrame创建一个图像序列以引入后期效果。在每一个循环中,我都会提高帧率——我肯定这不是最好的方法。在每次循环结束时,我都会保存帧,但saveFrame无法跟上我试图保存的逐渐提高的帧速率。有没有人知道如何在不提高帧速率的情况下实现我想要的效果,这样saveFrame就可以跟上进度?这是我的密码: ``` int w = 640; // canvas size int h = 480; int n = 10; // number of grid cells int d = w
```
int w = 640; // canvas size
int h = 480;
int n = 10; // number of grid cells
int d = w/n; // diameter of a grid cell
float depth = 0.5; // relative cell depth
int fr = 100;
int iterator = 0;
boolean doSaveFrames = false;
void setup() {
size(w, h, P3D);
rectMode(CENTER);
background(0);
fill(51, 255, 0);
noStroke();
frameRate(fr);
}
void draw() {
// get coordinates
int xy = frameCount % (n*n);
// shift image in z-direction
if (xy == 0) {
PImage img = get();
background(0);
pushMatrix();
translate(0, 0, -d * depth);
tint(255, 127);
image(img, 0, 0);
popMatrix();
// fr+=iterator*10;
// frameRate(fr); //MH - really cool but I can't export fast enough
iterator++;
}
// scale and rotate the square
scale(d);
translate(xy%n + .5, xy/n + .5, -depth * .5 );
rotate(QUARTER_PI - HALF_PI *int(random(2)));
rotateX(HALF_PI);
// draw the square
rect(0, 0, sqrt(2), depth);
if (doSaveFrames) {
saveFrame("frames/line-######.tga");
}
}
```
不要将动画基于
frameCount
变量,而是创建以自己的速度递增的自己的变量,然后随时间增加该速度。保持帧速率不变,但提高动画速度。您能解释一下为什么要提高帧速率吗?因为每次保存都会使动画速度越来越快,这没有任何意义…是的-我不想提高每次保存的速度,我想提高整个动画的速度,让保存帧捕捉到速度的提高-我想解决这个问题的一种方法是每N帧保存一次,每个周期的持续时间都在增加。我不这么认为,这可能是因为术语:在处理术语中,帧是draw()
方法开始和结束之间的图形状态,frameRate
决定每秒调用draw
的频率。您可以通过增加帧速率
值来加速动画,但无法在单个帧中捕获任何“速度增加”。。。单个帧没有速度。