Skip to content

@bloopjs/toodle


@bloopjs/toodle / textures/types / TexelRegion

Type Alias: TexelRegion ​

TexelRegion = object

Defined in: textures/types.ts:167

A texel region defines a subregion of an individual texture in texel units.

(0,0) is the top left corner of the original texture. (width, height) is the bottom right corner of the original texture.

Example ​

ts
This is useful for something like spritesheet animations,
for eg a 3-frame pose of a 32x32 character sprite might be 96x32 texels, and the animation could
be done by alternating between:

{ x: 0, y: 0, width: 32, height: 32 }
{ x: 32, y: 0, width: 32, height: 32 }
{ x: 64, y: 0, width: 32, height: 32 }

Properties ​

height ​

height: number

Defined in: textures/types.ts:171


width ​

width: number

Defined in: textures/types.ts:170


x ​

x: number

Defined in: textures/types.ts:168


y ​

y: number

Defined in: textures/types.ts:169