Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/maxiy01/tstl-anim8
Declarations for anim8, a small animation library for LÖVE.
https://github.com/maxiy01/tstl-anim8
anim8 lua tstl typescript typescript-to-lua
Last synced: 8 days ago
JSON representation
Declarations for anim8, a small animation library for LÖVE.
- Host: GitHub
- URL: https://github.com/maxiy01/tstl-anim8
- Owner: maxiy01
- License: mit
- Created: 2020-09-21T09:49:23.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-05-28T08:40:22.000Z (over 2 years ago)
- Last Synced: 2024-10-26T21:51:26.629Z (12 days ago)
- Topics: anim8, lua, tstl, typescript, typescript-to-lua
- Homepage:
- Size: 36.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TSTL anim8
Declarations for [anim8](https://github.com/kikito/anim8), a small animation library for LÖVE.
| Command | Description |
|-|-|
| `yarn add -D tstl-anim8` | Install these declarations |
| `yarn add kikito/anim8` | Install anim8 |Upon installation these declarations can be linked to a _tsconfig.json_ file.
```json
{
"compilerOptions": {
"types": [
"tstl-anim8"
]
}
}
```And used within any _.ts_ file.
```ts
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.
```ts
package.path += ";./node_modules/?/?.lua";
```Also you need to add `"typescript-to-lua/language-extensions"` to _tsconfig.json_ file.
```json
{
"compilerOptions": {
"types": [
"typescript-to-lua/language-extensions"
]
}
}
```