Hi everybody,
I recently started working with Processing in combination with Joshuas’ Hype Framework. I’m able to save single frames from an animation but only in the same resolution as the sketch e.g. 800x500. Is there a way save frames in a higher resolutions especially using Hype?
I found a snippet here on the forum providing a tile based solution but I can not get it running correctly.
HDrawablePool dp2;
HSwarm swarm;
HTimer timer;
int scaleValue = 3; // Multiplication factor
int xoffset = 0; // x-axis offset
int yoffset = 0; // y-axis offset
void setup() {
size(500,800);
H.init(this).background(#ffffff).autoClear(false);
smooth();
swarm = new HSwarm()
.addGoal(H.mouse())
.speed(10)
.turnEase(0.05f)
.twitch(40)
;
dp2 = new HDrawablePool(500);
dp2.autoAddToStage()
.add(new HEllipse(5))
// .add(new HRect(2))
.colorist(new HColorPool(#BFBFBF, #8C8C8C, #404040, #262626, #0D0D0D, #F2F2F2, #BFBFBF, #8C8C8C,#F23E2E).fillOnly())
.onCreate(
new HCallback() {
public void run(Object obj) {
int i = dp2.currentIndex();
HDrawable d = (HDrawable) obj;
d
.strokeWeight(1)
.stroke(#000000)
.loc(width/2, height)
.anchorAt(H.CENTER)
.size((int)random(10,50), (int)random(5,3) )
;
swarm.addTarget(d);
}
}
);
timer = new HTimer()
.numCycles( dp2.numActive() )
.interval(550)
.callback(
new HCallback() {
public void run(Object obj) {
dp2.request();
}
}
);
}
void draw() {
H.drawStage();
scale(scaleValue);
translate(xoffset * (-width/scaleValue), yoffset * (-height/scaleValue));
}
void keyPressed(){
if(key=='s'||key=='S')
// saveFrame("../frames/#########.tif");
setOffset();
}
void setOffset() {
save("../frames/lines-" + xoffset + "-" + yoffset + ".jpg");
xoffset++;
if (xoffset == scaleValue) {
xoffset = 0;
yoffset++;
if (yoffset == scaleValue) {
exit();
}
}
}
If anyone could point me in the right direction. Thanks in advance
Marcel