heaps-aseprite
所属分类:collect
开发工具:Haxe
文件大小:0KB
下载次数:0
上传日期:2023-05-18 22:34:49
上 传 者:
sh-1993
说明: 堆的Aseprite文件分析器,
(An Aseprite File Parser for Heaps,)
文件列表:
.vscode/ (0, 2023-05-05)
.vscode/launch.json (800, 2023-05-05)
.vscode/settings.json (135, 2023-05-05)
.vscode/tasks.json (412, 2023-05-05)
LICENSE (1068, 2023-05-05)
extraParams.hxml (80, 2023-05-05)
haxelib.json (425, 2023-05-05)
hxformat.json (763, 2023-05-05)
index.html (1259, 2023-05-05)
sample-hl.hxml (182, 2023-05-05)
sample-js.hxml (133, 2023-05-05)
sample.hxml (220, 2023-05-05)
sample/ (0, 2023-05-05)
sample/Main.hx (4235, 2023-05-05)
sample/res/ (0, 2023-05-05)
sample/res/anim_linked_cels.aseprite (14993, 2023-05-05)
sample/res/animation.aseprite (14187, 2023-05-05)
sample/res/grayscale.aseprite (1591, 2023-05-05)
sample/res/indexed_multi_layer.aseprite (1991, 2023-05-05)
sample/res/pong.aseprite (2162, 2023-05-05)
sample/res/props.json (33, 2023-05-05)
sample/res/slices.aseprite (5400, 2023-05-05)
sample/res/slices2.aseprite (3386, 2023-05-05)
sample/res/subdir-test/ (0, 2023-05-05)
sample/res/subdir-test/128x128_rgba.aseprite (1172, 2023-05-05)
sample/res/tags.ase (20305, 2023-05-05)
sample/res/test.aseprite (903, 2023-05-05)
src/ (0, 2023-05-05)
src/aseprite/ (0, 2023-05-05)
src/aseprite/AseAnim.hx (2467, 2023-05-05)
src/aseprite/Aseprite.hx (7182, 2023-05-05)
src/aseprite/AsepriteData.hx (250, 2023-05-05)
src/aseprite/Dictionary.hx (5343, 2023-05-05)
src/aseprite/Frame.hx (182, 2023-05-05)
src/aseprite/Layer.hx (423, 2023-05-05)
src/aseprite/Macros.hx (514, 2023-05-05)
src/aseprite/Palette.hx (824, 2023-05-05)
src/aseprite/Reg.hx (143, 2023-05-05)
... ...
# heaps-aseprite
Load and render sprites and animations in Aseprite format. Based on the [ase](https://github.com/miriti/ase) and [openfl-aseprite](https://github.com/miriti/openfl-aseprite) libraries. Sample Aseprite files all borrowed from `openfl-aseprite`.
## Features
* Hooks into the Heaps Engine's resource management to automatically handle any `.aseprite` or `.ase` file
* Optimizes runtime performance by parsing Aseprite files during compilation (generating `.png` and `.asedata` files)
* Supports all Color Modes, Animation Tags, Layers, and Slices (including 9-Slices!)
* Includes the `AseAnim` Class to easily render Animations (based on the Heaps Engine's `Anim` Class)
* Supports Live Resource Updating
* Gets Type-safe references to an Aseprite file's Tags and Slices (thanks @deepnight!)
## Getting Started
heaps-aseprite requires [Haxe 4](https://haxe.org/download/) and the [Heaps Engine](https://heaps.io) to run.
Install the library from haxelib:
```
haxelib install heaps-aseprite
```
Alternatively the dev version of the library can be installed from github:
```
haxelib git heaps-aseprite https://github.com/AustinEast/heaps-aseprite.git
```
Install heaps-aseprite's dependency, [ase](https://github.com/miriti/ase).
```
haxelib install ase
```
Then include the library in your project's `.hxml`:
```hxml
-lib heaps-aseprite
```
## Example
```haxe
// Get the whole sprite as a Tile
var spr1 = new Bitmap(Res.single_frame_sprite.toAseprite().toTile(), s2d);
// Alternatively get the sprite directly as an Image
var image = new Bitmap(Res.single_frame_sprite.toImage().toTile(), s2d);
// Get an animation from the sprite's tag
var spr2 = new AseAnim(Res.animated_sprite.toAseprite().getTag('walk'), s2d);
spr2.loop = true;
// Override the direction of a tagged animation
var spr3 = new AseAnim(Res.animated_sprite.toAseprite().getTag('walk', AnimationDirection.REVERSE), s2d);
spr3.loop = true;
// Get an animation based on tag and slice
var spr4 = new AseAnim(Res.animated_sprite.toAseprite().getTag('walk', -1, 'Head'), s2d);
spr4.loop = true;
// Get a single frame from a slice
var slice = new Bitmap(Res.slices.toAseprite().getSlice('Slice 1').tile, s2d);
// Get all frames from a slice
var slice2 = new AseAnim(Res.slices.toAseprite().getSlices('Slice 1'), s2d);
slice2.loop = true;
// Get a 9-Slice ScaleGrid from a slice
var nineSlice = Res.nine_slices.toAseprite().toScaleGrid('9-Slices', 0, s2d);
// Live Resource Updatng
var animation = new AseAnim(Res.animated_sprite.toAseprite().getTag('walk'), s2d);
animation.loop = true;
Res.animated_sprite.watch(() -> {
// Make sure to call the default `watch()` callback!
Res.animated_sprite.updateData();
// Replay the animation to get the updated frames
animation.play(Res.animated_sprite.toAseprite().getTag('walk'));
});
// Want type-safe Tags and Slices? Use the `Dictionary` class to get typed references from an Aseprite resource
var typeSafeTags = Dictionary.getTags(Res.animated_sprite);
new AseAnim(Res.animated_sprite.toAseprite().getTag(typeSafeTags.walk), flow);
var typeSafeSlices = Dictionary.getSlices(Res.slices);
new Bitmap(Res.slices.toAseprite().getSlice(typeSafeSlices.Slice_1).tile, flow);
```
## Roadmap
* Document codebase (public fields and methods)
近期下载者:
相关文件:
收藏者: