mirror of
https://github.com/ful1e5/apple_cursor.git
synced 2025-05-19 09:45:41 -04:00
🚀 Render Configs
This commit is contained in:
parent
75206b4a22
commit
bb4cc91d4f
1 changed files with 5 additions and 5 deletions
10
src/index.ts
10
src/index.ts
|
@ -61,7 +61,7 @@ const main = async () => {
|
||||||
const template = generateRenderTemplate(data);
|
const template = generateRenderTemplate(data);
|
||||||
|
|
||||||
const page = await browser.newPage();
|
const page = await browser.newPage();
|
||||||
await page.setContent(template);
|
await page.setContent(template, { waitUntil: "networkidle2" });
|
||||||
|
|
||||||
await page.waitForSelector("#container");
|
await page.waitForSelector("#container");
|
||||||
const svgElement = await page.$("#container svg");
|
const svgElement = await page.$("#container svg");
|
||||||
|
@ -69,7 +69,7 @@ const main = async () => {
|
||||||
|
|
||||||
// Render Config
|
// Render Config
|
||||||
let index = 1;
|
let index = 1;
|
||||||
let breakLoop = false;
|
let breakRendering = false;
|
||||||
const frames: Frames = {};
|
const frames: Frames = {};
|
||||||
const firstKey = getKeyName(index, svgPath);
|
const firstKey = getKeyName(index, svgPath);
|
||||||
console.log(firstKey);
|
console.log(firstKey);
|
||||||
|
@ -85,7 +85,7 @@ const main = async () => {
|
||||||
|
|
||||||
// Pushing frames until it match to 1st frame
|
// Pushing frames until it match to 1st frame
|
||||||
index++;
|
index++;
|
||||||
while (!breakLoop) {
|
while (!breakRendering) {
|
||||||
const newFrame = await svgElement.screenshot({
|
const newFrame = await svgElement.screenshot({
|
||||||
omitBackground: true,
|
omitBackground: true,
|
||||||
clip: animatedClip,
|
clip: animatedClip,
|
||||||
|
@ -98,10 +98,10 @@ const main = async () => {
|
||||||
img2Buff: newFrame,
|
img2Buff: newFrame,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!(diff < 3000)) {
|
if (!(diff < 1700)) {
|
||||||
frames[key] = { buffer: newFrame };
|
frames[key] = { buffer: newFrame };
|
||||||
} else {
|
} else {
|
||||||
breakLoop = true;
|
breakRendering = true;
|
||||||
}
|
}
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue