Skip to content

Instantly share code, notes, and snippets.

@FunctionDJ
Created April 12, 2021 19:25
Show Gist options
  • Save FunctionDJ/5f0284e4f833960d6d94bf73aea50d36 to your computer and use it in GitHub Desktop.
Save FunctionDJ/5f0284e4f833960d6d94bf73aea50d36 to your computer and use it in GitHub Desktop.
type Mapped<T> = {
[key: string]: T
}
export interface CharacterData {
face?: Face | string | FaceMap
}
export interface Face {
width: number
height: number
centerX: number
centerY: number
src: string
subImages?: SubImageMap
parts: PartMap
expressions: ExpressionMap
}
export type FaceMap = Mapped<string>; // unexpected, CC do be like that
export type PartMap = Mapped<Part>;
export type SubImageMap = Mapped<string>;
export type ExpressionMap = Mapped<Expression>;
export interface Part {
srcX: number, srcY: number
width: number, height: number
destX: number, destY: number
subX?: number, subY?: number
img?: string
}
export interface Expression {
anim?: number[]
time?: number
repeat?: number
faces: string[][]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment