Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/spritejs/spritejs
A cross platform high-performance graphics system.
https://github.com/spritejs/spritejs
2d 3d canvas rendering webgl webgl2
Last synced: 5 days ago
JSON representation
A cross platform high-performance graphics system.
- Host: GitHub
- URL: https://github.com/spritejs/spritejs
- Owner: spritejs
- License: mit
- Created: 2017-07-05T07:04:45.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-06-09T14:25:58.000Z (7 months ago)
- Last Synced: 2024-12-31T00:07:49.566Z (12 days ago)
- Topics: 2d, 3d, canvas, rendering, webgl, webgl2
- Language: JavaScript
- Homepage: http://spritejs.com
- Size: 40.8 MB
- Stars: 5,346
- Watchers: 109
- Forks: 324
- Open Issues: 75
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome - spritejs/spritejs - A cross platform high-performance graphics system. (JavaScript)
- awesome-github-star - spritejs - performance graphics system. | spritejs | 5245 | (JavaScript)
- awesome-made-by-chinese - spritejs
README
[![npm status](https://img.shields.io/npm/v/spritejs.svg)](https://www.npmjs.org/package/spritejs)
[![build status](https://api.travis-ci.org/spritejs/spritejs.svg?branch=master)](https://travis-ci.org/spritejs/spritejs)
[![Package Quality](http://npm.packagequality.com/shield/spritejs.svg?v=3)](http://packagequality.com/#?package=spritejs)
[![Maintainability](https://api.codeclimate.com/v1/badges/8327f502ee8ba003c6b8/maintainability)](https://codeclimate.com/github/spritejs/spritejs/maintainability)
[![License](https://img.shields.io/npm/l/spritejs.svg)](LICENSE)Spritejs is a cross platform high-performance graphics system, which can render graphics on web, node, desktop applications and mini-programs.
SpritejsNext is the new version of spritejs. It is renderer agnostic enabling the same api to render in multiple contexts: webgl2, webgl, and canvas2d.
Manipulate the **sprites** in canvas as you do with the DOM elements.
## Features
- Manipulate the sprites element as you do with the DOM elements.
- Rendering by **WebGL2** context.
- Multiple layers.
- DOM Events.
- Object Oriented Programmed Development with ES6+.
- OffscreenCanvas and [Web Worker](https://spritejs.com/#/en/guide/worker).
- Work with [d3](https://github.com/d3/d3).
- [Server-side rendering](https://spritejs.com/#/en/guide/platforms).
- [Vue](http://vue.spritejs.com).## Quick Start
**SpriteJS** - spritejs.com
```html
const imgUrl = 'https://s5.ssl.qhres2.com/static/ec9f373a383d7664.svg'
const {Scene, Sprite} = spritejs;
const container = document.getElementById('container');
const paper = new Scene({
container,
width: 400,
height: 400,
})const sprite = new Sprite(imgUrl)
sprite.attr({
bgcolor: '#fff',
pos: [0, 0],
size: [400, 400],
borderRadius: '200'
})paper.layer().appendChild(sprite)
```
Learn more at spritejs.com## Usage
In browser:
```html
```
With Node.js:
```bash
npm install spritejs --save
``````js
import * as spritejs from 'spritejs';
```## 3D
SpriteJSNext can render 3D elements through [3D extension library](https://github.com/spritejs/sprite-extend-3d).
```html
```
Or from NPM
```js
import {Scene} from 'spritejs';
import {Cube, shaders} from 'sprite-extend-3d';
```## Examples
### Basic
- [Overview](http://spritejs.com/demo/)
- [Sprites](http://spritejs.com/demo/#basic_sprites)
- [Path & Group](http://spritejs.com/demo/#path_groups)
- [Labels](http://spritejs.com/demo/#labels)
- [Button](http://spritejs.com/demo/#button)
- [Transforms](http://spritejs.com/demo/#transforms)
- [Events](http://spritejs.com/demo/#events)
- [Filters](http://spritejs.com/demo/#filters)
- [Animations](http://spritejs.com/demo/#animations)
- [SVG Paths](http://spritejs.com/demo/#svg_path)
- [Offset API](http://spritejs.com/demo/#offset_api)### With D3
Compatible with [d3.js](https://github.com/d3/d3).
- [Bar Graph](http://spritejs.com/demo/#/d3/bar)
- [Hierarchy](http://spritejs.com/demo/#/d3/hierarchy)
- [Map](http://spritejs.com/demo/#/d3/map)
- [Force Links](http://spritejs.com/demo/#/d3/links)### 3D Extension
- [3D Cube](http://spritejs.com/demo/#/3d/basic)
- [Camera](http://spritejs.com/demo/#/3d/camera2)
- [Cube Map](http://spritejs.com/demo/#/3d/cubemap)
- [Physically Based Rendering](http://spritejs.com/demo/#/3d/pbr)
- [Geometry](http://spritejs.com/demo/#/3d/geometry)
- [Geometry Model](http://spritejs.com/demo/#/3d/geometry3)
- [Model & Texture](http://spritejs.com/demo/#/3d/model_texture)
- [Groups](http://spritejs.com/demo/#/3d/group3)
- [Skydom](http://spritejs.com/demo/#/3d/skydom)
- [Video](http://spritejs.com/demo/#/3d/video)
- [Shadow](http://spritejs.com/demo/#/3d/shadow)
- [Post channel](http://spritejs.com/demo/#/3d/post)
- [GPGPU](http://spritejs.com/demo/#/3d/gpgpu)### [Q-Charts](https://github.com/spritejs/q-charts)
A visulization library based on spritejs.
- [QCharts basic](https://www.qcharts.cn/#/demo/line/default)
- [Lines](https://www.qcharts.cn/#/demo/line/multi)
- [Smooth Lines](https://www.qcharts.cn/#/demo/line/smooth)
- [Lines & Bars](https://www.qcharts.cn/#/more/line-mixLineAndBar)
- [Area Chart](https://www.qcharts.cn/#/demo/area/stack)
- [Pie Chart](https://www.qcharts.cn/#/demo/pie/default)
- [Rose Chart](https://www.qcharts.cn/#/demo/polarBar/group)
- [Radar Chart](https://www.qcharts.cn/#/demo/radar/default)
- [Bubble Chart](https://www.qcharts.cn/#/demo/scatter/bubble)### Ecosystem & Extensions
| **Project** | **Description** |
| ------------------------------- | ----------------------------------- |
| [sprite-vue](https://github.com/spritejs/sprite-vue)| SpriteJS for Vue.js. |
| [sprite-react](https://github.com/spritejs/sprite-react)| Rendering spritejs elements with React. |
| [q-charts](https://github.com/spritejs/q-charts) | A visulization library based on spritejs |
| [cat-charts-vue](https://github.com/spritejs/cat-charts-vue)| A visulization library based on spritejs , qcharts and Vue. |## Architecture
SpritejsNext provides several kinds of basic sprite elements, which can be operated on the layer like DOM elements.
![ζΆζεΎ](https://s0.ssl.qhres2.com/static/fe2ee3b6fd1aa59f.svg)
### Build
Build with NPM
```bash
npm run build
```Build Doc
```bash
npm run build-doc
```### Tests
```bash
npm test
```# V2
[SpriteJS v2.0](https://github.com/spritejs/spritejs/tree/v2)
# Compatibility
Compatible for most modern browsers.
You should import [babel-polyfill](https://cdn.baomitu.com/babel-polyfill) for early browers(i.e. iOS 8).
## Contributors
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
| | | | | | | |
| :---: | :---: | :---: | :---: | :---: | :---: | :---: |
| [
betseyliu](https://github.com/betseyliu)
[π»](https://github.com/spritejs/spritejs/commits?author=betseyliu "Code") [π](https://github.com/spritejs/spritejs/commits?author=betseyliu "Documentation") | [
Shero0311](https://github.com/Shero0311)
[π](https://github.com/spritejs/spritejs/commits?author=Shero0311 "Documentation") | [
ζ马](https://github.com/makeco)
[π](https://github.com/spritejs/spritejs/commits?author=makeco "Documentation") [π»](https://github.com/spritejs/spritejs/commit/e2ef39bafd81ee09494f5ebbaf0f8319dbd85122 "Code")| [
ζθΊ](https://github.com/AngusFu)
[π»](https://github.com/spritejs/spritejs/commits?author=AngusFu "Code") [π](https://github.com/spritejs/spritejs/issues/30 "Bug reports") | [
θ‘ζ―ζ°](https://github.com/SijieCai)
[π»](https://github.com/spritejs/sprite-core/commits?author=SijieCai "Code") [π](https://github.com/spritejs/spritejs/commits?author=SijieCai "Documentation") | [
Shaofei Cheng](https://github.com/wintercn)
[π»](https://github.com/spritejs/sprite-core/commits?author=wintercn "Code") [π](https://github.com/spritejs/spritejs/commits?author=wintercn "Documentation") | [
ζε€ͺι³](https://github.com/yaotaiyang)
[π](https://github.com/spritejs/spritejs/commits?author=yaotaiyang "Documentation")
| [
ε ¬ε](https://github.com/lizheming)
[π»](https://github.com/spritejs/sprite-core/commits?author=lizheming "Code") | [
justemit](https://github.com/justemit)
[π»](https://github.com/spritejs/sprite-extend-shapes/commits?author=justemit "Code") [π](https://github.com/spritejs/sprite-extend-shapes/commits?author=justemit "Documentation") [π](https://github.com/spritejs/sprite-core/issues/34 "Bug reports") | [
Welefen Lee](https://github.com/welefen)
[π»](https://github.com/spritejs/sprite-flex-layout "Code") | [
YUPENG12138](https://github.com/YUPENG12138)
[π](https://github.com/spritejs/spritejs/issues/52 "Documentation")| [
xinde](https://github.com/xinde)
[π](https://github.com/spritejs/spritejs/issues/59 "Bug reports")| [
ggvswild](https://github.com/ggvswild)
[π](https://github.com/spritejs/spritejs/issues/70 "Bug reports")| [
liulinboyi](https://github.com/liulinboyi)
[π»](https://github.com/spritejs/spritejs/commits?author=liulinboyi "Code")|
| [
Lulzx](https://github.com/Lulzx)
[π»](https://github.com/spritejs/sprite-core/commits?author=Lulzx "Code") | [
asidar](https://github.com/asidar)
[π»](https://github.com/spritejs/sprite-extend-shapes/commits?author=asidar "Code") | [
alphatr](https://github.com/alphatr)
[π»](https://github.com/spritejs/sprite-extend-shapes/commits?author=alphatr "Code") | [
W-Qing](https://github.com/W-Qing)
[π](https://github.com/spritejs/spritejs/commits?author=W-Qing "Documentation") |## Credits and Acknowledgements
- [svg-path-contours](https://github.com/mattdesl/svg-path-contours) Approximates an SVG path into a discrete list of 2D contours (polylines).
- [extrude-polyline](https://github.com/mattdesl/extrude-polyline) Extrudes a 2D polyline with a given line thickness and the desired join/cap types.
- [triangulate-contours](https://github.com/mattdesl/triangulate-contours) Triangulates a series of contours using Tess2.js.
- [OGL](https://github.com/oframe/ogl) OGL is a small, effective WebGL library aimed at developers who like minimal layers of abstraction, and are comfortable creating their own shaders.
## License
[MIT](LICENSE)