mirror of
https://github.com/ful1e5/Bibata_Cursor.git
synced 2025-05-19 09:45:24 -04:00
🔑 Frame key utils
This commit is contained in:
parent
e6694cd487
commit
155dac47a8
1 changed files with 14 additions and 0 deletions
14
packages/common/src/utils/getKeyName.ts
Normal file
14
packages/common/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, 2);
|
||||||
|
return `${path.basename(fileName, ".svg")}-${frame}.png`;
|
||||||
|
};
|
Loading…
Add table
Add a link
Reference in a new issue