mirror of
https://github.com/ful1e5/Bibata_Cursor.git
synced 2025-05-24 12:07:02 -04:00
🖼️ Animated pngs render
This commit is contained in:
parent
05a7d723f6
commit
3116d8f50d
4 changed files with 141 additions and 45 deletions
|
@ -24,16 +24,25 @@ const main = async () => {
|
|||
const png = new BitmapsGenerator(bitmapsDir);
|
||||
const browser = await png.getBrowser();
|
||||
|
||||
SVG.getStatic().forEach(async (svg) => {
|
||||
for (const svg of SVG.getStatic()) {
|
||||
const key = `${path.basename(svg, ".svg")}.png`;
|
||||
console.log("Saving", key, "...");
|
||||
const out = path.resolve(bitmapsDir, key);
|
||||
|
||||
let content = fs.readFileSync(svg, "utf-8");
|
||||
content = SVGHandler.colorSvg(content, color);
|
||||
|
||||
await png.generate(browser, content, out);
|
||||
});
|
||||
await png.generateStatic(browser, content, key);
|
||||
}
|
||||
|
||||
for (const svg of SVG.getAnimated()) {
|
||||
const key = `${path.basename(svg, ".svg")}.png`;
|
||||
|
||||
let content = fs.readFileSync(svg, "utf-8");
|
||||
content = SVGHandler.colorSvg(content, color);
|
||||
|
||||
await png.generateAnimated(browser, content, key);
|
||||
}
|
||||
|
||||
await browser.close();
|
||||
};
|
||||
|
||||
main();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue