# saveFrame problem

**URL:** <https://discourse.processing.org/t/saveframe-problem/11244>\
**Category:** Coding Questions\
**Created:** [May 15, 2019, 12:23am UTC](https://discourse.processing.org/t/saveframe-problem/11244 "2019-05-15T00:23:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mellebond](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/mellebond/32/5177_2.png) [@mellebond](https://discourse.processing.org/u/mellebond)\
**Post date:** [May 15, 2019, 12:23am UTC](https://discourse.processing.org/t/saveframe-problem/11244/1 "2019-05-15T00:23:55Z")

</div>

Hi there,

I have the strange problem that if I turn on saveFrame my sketch shows something a little different then when turned off. When it’s turned off it looks the way I want it. I feel like with saveFrame on it’s missing the millis effects…

Here’s the code:

static final int NUM = 0120, NEWEST = NUM - 1;  
final float[] x = new float[NUM], y = new float[NUM];  
PVector center;  
float angle;  
float radius;

void setup() {  
size(1920, 1080);  
//size(3840, 2160);

colorMode(RGB, NEWEST);  
frameRate(50);  
smooth(4);  
strokeWeight(2);  
background(255);

center = new PVector(width/2, height/2);  
PVector point = new PVector(230,230);  
float deltaX = center.x - point.x;  
float deltaY = center.y - point.y;  
angle = atan2(deltaX, deltaY);  
radius = dist(center.x, center.y, point.x, point.y);

for (int i = NUM; i-- != 0; x[i] = center.x+ cos(angle)\*radius+random(-300,300), y[i] = center.y + sin(angle)\*radius+random(-400,400));  
}

void draw() {

if (millis() \> 18500)  
angle += (PI/26.0869);  
else {  
angle += (PI/26.0869/2);  
}

if (millis() \< 31000){  
background(NEWEST);  
for (int i = 0; i != NEWEST;) {  
stroke(NEWEST-i);  
line(width/2, height/2, x[i] = x[i + 1], y[i] = y[++i]);  
}  
x[NEWEST] = center.x+ cos(angle)\*radius+random(-300,300);  
y[NEWEST] = center.y + sin(angle)\*radius+random(-400,400);  
}  
else {

stroke(0);  
line(width/2,height/2, center.x+ cos(angle)\*radius+random(-300,300),center.y + sin(angle)\*radius+random(-400,400));  
}

saveFrame(“untitled1\_####.png”);

}

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [May 15, 2019, 12:47am UTC](https://discourse.processing.org/t/saveframe-problem/11244/2 "2019-05-15T00:47:41Z")

</div>

please format your code using the

```auto
</> code tag

```

looks like  
```  
type or paste code here  
```

* * *

the first idea could be that the multiple file saving ? at every draw loop  
( 50 pictures per sec )  
takes too much time ( results in low FPS ) so a millis compare ends with different pictures,  
possibly here a frameCount better as millis?
