mirror of
https://github.com/ful1e5/apple_cursor.git
synced 2025-05-31 15:28:20 -04:00
🔗 Key util
This commit is contained in:
parent
3a6d9f7200
commit
b4a678497c
1 changed files with 14 additions and 0 deletions
14
src/utils/getKeyName.ts
Normal file
14
src/utils/getKeyName.ts
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
import path from "path";
|
||||||
|
|
||||||
|
export const frameNumber = (index: number, endIndex: number) => {
|
||||||
|
let result = "" + index;
|
||||||
|
while (result.length < endIndex) {
|
||||||
|
result = "0" + result;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getKeyName = (index: number, fileName: string) => {
|
||||||
|
const frame = frameNumber(index, frames.toString().length);
|
||||||
|
return `${path.basename(fileName, ".svg")}-${frame}.png`;
|
||||||
|
};
|
Loading…
Add table
Add a link
Reference in a new issue