# wesa
**Repository Path**: mriiiron/wesa
## Basic Information
- **Project Name**: wesa
- **Description**: 基于 WebGL 的超级轻量 2D 精灵动画引擎
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-09-17
- **Last Updated**: 2020-12-19
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
WESA - WebGL-based Engine of Sprite Animation
-----------------------------------------------
Perhaps the simplest and lightest (14KB, currently) solution for turning your brilliant idea into old-school style, pixel-friendly sprite animations being displayed on the web.
You may consider to use fancy libs such as [PixiJS](http://www.pixijs.com) or even [ThreeJS](https://threejs.org), but WESA would be your simple but elegant start to learn to animate your favorite sprites in browser.
WesaJS will always be fully open-sourced, for the sake of my personal passion on sprite animations and retro-style games.
### Basic Example
#### Include WESA
```html
```
#### Prepare a Canvas
```html
```
#### Write Scripts
```javascript
// Initializing WESA
wesa.core.init(document.getElementById('canvas'));
// Adding sprite sheets
wesa.assets.source.spriteSheetUrlArray.push('./assets/texture/megaman.png');
// Adding object definition file
wesa.assets.source.objectJsonUrl = './assets/megaman.json';
wesa.assets.load(function () {
// Create the scene
let scene = new wesa.Scene('Scene');
// Add a sprite
scene.addSpriteToLayer(0, new wesa.Sprite({
object: wesa.assets.objectList[0],
action: 0,
team: 0,
position: { x: 0, y: 0 },
scale: 4
}));
// Run the scene
let animate = function () {
requestAnimationFrame(animate);
scene.update();
scene.render();
}
animate();
});
```
[See full demo](http://mriiiron.gitee.io/wesa/)
### More Demos
* Coming soon!
### Gallery
* [OpenCity](http://mriiiron.gitee.io/open-city/)
### History
WesaJS is a successor of my following college works:
- [aero-engine-3d](https://github.com/mriiiron/aero-engine-d3d): C++ & DirectX;
- [aero-engine-opengl](https://github.com/mriiiron/aero-engine-opengl): C++ & OpenGL.
### To-do
- [x] Pausing
### License
MIT