1.0.2 • Published 2 years ago

tstl-anim8 v1.0.2

Weekly downloads
2
License
ISC
Repository
github
Last release
2 years ago

TSTL anim8

Declarations for anim8, a small animation library for LÖVE.

CommandDescription
yarn add -D tstl-anim8Install these declarations
yarn add kikito/anim8Install anim8

Upon installation these declarations can be linked to a tsconfig.json file.

{
    "compilerOptions": {
        "types": [
            "tstl-anim8"
        ]
    }
}

And used within any .ts file.

import * as anim8 from "anim8"

let spritesheet = love.graphics.newImage('path/to/your/spritesheet');
let grid = anim8.newGrid(16,16,spritesheet.getWidth(),spritesheet.getHeight());
let frames = grid.getFrames(1,1, 2,1, 3,1);
let frame_duration = [0.5,0.5,0.5];
let animation = anim8.newAnimation(frames,frame_duration);

love.update = (dt: number) => {
    animation.update(dt);
}

love.draw = () => {
    animation.draw(spritesheet, 100, 100);
}

Make sure to append ";./node_modules/?/?.lua" to your package.path in a conf.ts file (this is run first) to assist where Lua looks for modules.

package.path += ";./node_modules/?/?.lua";

Also you need to add "typescript-to-lua/language-extensions" to tsconfig.json file.

{
    "compilerOptions": {
        "types": [
            "typescript-to-lua/language-extensions"
        ]
    }
}
1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago

0.0.0

4 years ago