Files
bridget/assets/ts/resources.ts
Sped0n d32d5b5e4f fix(main.ts): import correct functions from utils module
feat(stage.ts): implement stage navigation functionality
feat(stageNav.ts): implement stage navigation overlay functionality
feat(state.ts): implement state management for index and threshold
feat(utils.ts): add utility functions for increment and decrement
2023-10-29 00:58:53 +08:00

22 lines
471 B
TypeScript

// data structure for images info
export interface ImageJSON {
index: number
url: string
imgH: number
imgW: number
pColor: string
sColor: string
}
export function initResources(): ImageJSON[] {
const imagesJson = document.getElementById('imagesSource') as HTMLScriptElement
return JSON.parse(imagesJson.textContent as string).sort(
(a: ImageJSON, b: ImageJSON) => {
if (a.index < b.index) {
return -1
}
return 1
}
)
}