From bb4cc91d4fa63a4d9a3cada27a0b0d8fe7bcade2 Mon Sep 17 00:00:00 2001 From: ful1e5 <24286590+ful1e5@users.noreply.github.com> Date: Sun, 30 Aug 2020 12:40:47 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20Render=20Configs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/index.ts b/src/index.ts index 9bd498c..909982f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -61,7 +61,7 @@ const main = async () => { const template = generateRenderTemplate(data); const page = await browser.newPage(); - await page.setContent(template); + await page.setContent(template, { waitUntil: "networkidle2" }); await page.waitForSelector("#container"); const svgElement = await page.$("#container svg"); @@ -69,7 +69,7 @@ const main = async () => { // Render Config let index = 1; - let breakLoop = false; + let breakRendering = false; const frames: Frames = {}; const firstKey = getKeyName(index, svgPath); console.log(firstKey); @@ -85,7 +85,7 @@ const main = async () => { // Pushing frames until it match to 1st frame index++; - while (!breakLoop) { + while (!breakRendering) { const newFrame = await svgElement.screenshot({ omitBackground: true, clip: animatedClip, @@ -98,10 +98,10 @@ const main = async () => { img2Buff: newFrame, }); - if (!(diff < 3000)) { + if (!(diff < 1700)) { frames[key] = { buffer: newFrame }; } else { - breakLoop = true; + breakRendering = true; } index++; }