mirror of
https://github.com/ful1e5/apple_cursor.git
synced 2025-05-23 19:47:05 -04:00
💖
This commit is contained in:
parent
561fdbca19
commit
f3f3778ab2
1 changed files with 3 additions and 13 deletions
16
src/index.ts
16
src/index.ts
|
@ -2,7 +2,8 @@ import fs from "fs";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import puppeteer from "puppeteer";
|
import puppeteer from "puppeteer";
|
||||||
|
|
||||||
import { generateRenderTemplate } from "./helpers/htmlTemplate";
|
import { generateRenderTemplate } from "./utils/htmlTemplate";
|
||||||
|
import { getFrameNumber } from "./utils/getFrameNumber";
|
||||||
import {
|
import {
|
||||||
staticCursors,
|
staticCursors,
|
||||||
bitmapsDir,
|
bitmapsDir,
|
||||||
|
@ -11,17 +12,6 @@ import {
|
||||||
animatedClip,
|
animatedClip,
|
||||||
} from "./config";
|
} from "./config";
|
||||||
|
|
||||||
// --------------------------- Helpers
|
|
||||||
const frameNumber = (number: number, length: number) => {
|
|
||||||
var str = "" + number;
|
|
||||||
while (str.length < length) {
|
|
||||||
str = "0" + str;
|
|
||||||
}
|
|
||||||
return str;
|
|
||||||
};
|
|
||||||
|
|
||||||
// --------------------------- Main
|
|
||||||
|
|
||||||
const main = async () => {
|
const main = async () => {
|
||||||
const browser = await puppeteer.launch({
|
const browser = await puppeteer.launch({
|
||||||
ignoreDefaultArgs: [" --single-process ", "--no-sandbox"],
|
ignoreDefaultArgs: [" --single-process ", "--no-sandbox"],
|
||||||
|
@ -80,7 +70,7 @@ const main = async () => {
|
||||||
// Render Frames
|
// Render Frames
|
||||||
for (let index = 1; index <= frames; index++) {
|
for (let index = 1; index <= frames; index++) {
|
||||||
// config
|
// config
|
||||||
const frame = frameNumber(index, frames.toString().length);
|
const frame = getFrameNumber(index, frames.toString().length);
|
||||||
const bitmap =
|
const bitmap =
|
||||||
frames == 1
|
frames == 1
|
||||||
? `${path.basename(svg, ".svg")}.png`
|
? `${path.basename(svg, ".svg")}.png`
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue