tools/screenshots/renderer.js
function nextAnim() {
    const anim = config.animations[++index];
    if (anim) {

        const encoder = new GIFEncoder(app.view.width, app.view.height);

        // Stream output
        encoder.createReadStream().pipe(fs.createWriteStream(
            path.join(outputPath, anim.filename + '.gif')
        ));

        encoder.start();
        encoder.setRepeat(0);   // 0 for repeat, -1 for no-repeat
        encoder.setDelay(anim.delay || 500);  // frame delay in ms
        encoder.setQuality(10); // image quality. 10 is default.

        // Add the frames
        anim.frames.forEach((frame) => {
            encoder.addFrame(frames[frame]);
            delete frames[frame];
        });

        encoder.finish();

        // Wait for next stack to render next animation
        setTimeout(nextAnim, 0);
    }
    else {
        complete();
    }
}
function nextAnim() {
    const anim = config.animations[++index];
    if (anim) {

        const encoder = new GIFEncoder(app.view.width, app.view.height);

        // Stream output
        encoder.createReadStream().pipe(fs.createWriteStream(
            path.join(outputPath, anim.filename + '.gif')
        ));

        encoder.start();
        encoder.setRepeat(0);   // 0 for repeat, -1 for no-repeat
        encoder.setDelay(anim.delay || 500);  // frame delay in ms
        encoder.setQuality(10); // image quality. 10 is default.

        // Add the frames
        anim.frames.forEach((frame) => {
            encoder.addFrame(frames[frame]);
            delete frames[frame];
        });

        encoder.finish();

        // Wait for next stack to render next animation
        setTimeout(nextAnim, 0);
    }
    else {
        complete();
    }
}
function nextAnim ( ) { const anim = config . animations [ ++ index ] ; if ( anim ) { const encoder = new GIFEncoder ( app . view . width , app . view . height ) ; // Stream output encoder . createReadStream ( ) . pipe ( fs . createWriteStream ( path . join ( outputPath , anim . filename + '.gif' ) ) ) ; encoder . start ( ) ; encoder . setRepeat ( 0 ) ; // 0 for repeat, -1 for no-repeat encoder . setDelay ( anim . delay || 500 ) ; // frame delay in ms encoder . setQuality ( 10 ) ; // image quality. 10 is default. // Add the frames anim . frames . forEach ( ( frame ) => { encoder . addFrame ( frames [ frame ] ) ; delete frames [ frame ] ; } ) ; encoder . finish ( ) ; // Wait for next stack to render next animation setTimeout ( nextAnim , 0 ) ; } else { complete ( ) ; } }
Combine a bunch of frames
Combine a bunch of frames