MCPcopy
hub / github.com/spritejs/spritejs

github.com/spritejs/spritejs @v3.8.2 sqlite

repository ↗ · DeepWiki ↗ · release v3.8.2 ↗
10,961 symbols 31,250 edges 644 files 736 documented · 7%
README

spritejs logo

spritejs.com

npm status build status Package Quality Maintainability 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.
  • Work with d3.
  • Server-side rendering.
  • Vue.

Quick Start

SpriteJS - spritejs.com

<script src="https://unpkg.com/spritejs@3/dist/spritejs.min.js"></script>





<script>
    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)
</script>

Learn more at spritejs.com

Usage

In browser:

<script src="https://unpkg.com/spritejs@3/dist/spritejs.min.js"></script>

With Node.js:

npm install spritejs --save
import * as spritejs from 'spritejs';

3D

SpriteJSNext can render 3D elements through 3D extension library.

<script src="https://unpkg.com/spritejs@3/dist/spritejs.es.min.js"></script>
<script src="https://unpkg.com/sprite-extend-3d/dist/sprite-extend-3d.js"></script>

Or from NPM

import {Scene} from 'spritejs';
import {Cube, shaders} from 'sprite-extend-3d';

Examples

Basic

With D3

Compatible with d3.js.

3D Extension

Q-Charts

A visulization library based on spritejs.

Ecosystem & Extensions

Project Description
sprite-vue SpriteJS for Vue.js.
sprite-react Rendering spritejs elements with React.
q-charts A visulization library based on 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.

架构图

Build

Build with NPM

npm run build

Build Doc

npm run build-doc

Tests

npm test

V2

SpriteJS v2.0

Compatibility

Compatible for most modern browsers.

You should import babel-polyfill for early browers(i.e. iOS 8).

Contributors

Thanks goes to these wonderful people (emoji key):

[

betseyliu](https://github.com/betseyliu)

💻 📖 | [

Shero0311](https://github.com/Shero0311)

📖 | [

有马](https://github.com/makeco)

📖 💻| [

文蔺](https://github.com/AngusFu)

💻 🐛 | [

蔡斯杰](https://github.com/SijieCai)

💻 📖 | [

Shaofei Cheng](https://github.com/wintercn)

💻 📖 | [

摇太阳](https://github.com/yaotaiyang)

📖
| [

公子](https://github.com/lizheming)

💻 | [

justemit](https://github.com/justemit)

💻 📖 🐛 | [

Welefen Lee](https://github.com/welefen)

💻 | [

YUPENG12138](https://github.com/YUPENG12138)

📖| [

xinde](https://github.com/xinde)

🐛| [

ggvswild](https://github.com/ggvswild)

🐛| [

liulinboyi](https://github.com/liulinboyi)

💻| | [

Lulzx](https://github.com/Lulzx)

💻 | [

asidar](https://github.com/asidar)

💻 | [

alphatr](https://github.com/alphatr)

💻 | [

W-Qing](https://github.com/W-Qing)

📖 |

Credits and Acknowledgements

  • svg-path-contours Approximates an SVG path into a discrete list of 2D contours (polylines).

  • extrude-polyline Extrudes a 2D polyline with a given line thickness and the desired join/cap types.

  • triangulate-contours Triangulates a series of contours using Tess2.js.

  • 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

Extension points exported contracts — how you extend this code

Trasition (Interface)
* Transitions enable you to define the transition between two states of an element. [3 implementers]
typings/spritejs.d.ts
Timeline (Interface)
* Custom timeline. https://github.com/spritejs/sprite-timeline
typings/spritejs.d.ts
Timing (Interface)
* Timing properties of an animation.
typings/spritejs.d.ts
Animation (Interface)
* Web animation for sprite nodes.
typings/spritejs.d.ts
Filter (Interface)
* Sprite filter description.
typings/spritejs.d.ts

Core symbols most depended-on inside this repo

d
called by 3479
docs/demo/spritejs.es.js
n
called by 2342
docs/demo/assets/js/chunk-vendors.f65e2cdd.chunk.js
n
called by 1838
docs/demo/typescript.worker.js
t
called by 781
docs/demo/typescript.worker.js
get
called by 719
docs/demo/spritejs.es.js
d
called by 518
docs/demo/spritejs.esm.js
d
called by 511
docs/demo/spritejs.worker.es.js
d
called by 511
docs/demo/spritejs.worker.esm.js

Shape

Function 6,464
Method 4,026
Class 458
Interface 13

Languages

TypeScript100%

Modules by API surface

docs/demo/typescript.worker.js1,144 symbols
docs/demo/spritejs.esm.js1,052 symbols
docs/demo/spritejs.es.js1,052 symbols
docs/demo/spritejs.worker.esm.js1,020 symbols
docs/demo/spritejs.worker.es.js1,020 symbols
docs/demo/spritejs.es.min.js927 symbols
docs/demo/spritejs.worker.es.min.js904 symbols
docs/demo/spritejs.js488 symbols
docs/demo/spritejs.worker.js479 symbols
benchmark/js/cocos2d-js-v3.13.js397 symbols
docs/demo/assets/js/chunk-vendors.f65e2cdd.chunk.js365 symbols
docs/demo/spritejs.worker.min.js316 symbols

Dependencies from manifests, versioned

@babel/cli7.14.8 · 1×
@babel/core7.4.5 · 1×
@babel/plugin-proposal-class-properties7.4.4 · 1×
@babel/plugin-transform-runtime7.4.4 · 1×
@babel/preset-env7.4.5 · 1×
@babel/register7.8.6 · 1×
@babel/runtime7.4.5 · 1×
@demosify/core0.6.0 · 1×
@mesh.js/core1.1.23 · 1×
@purtuga/esm-webpack-plugin1.2.1 · 1×
babel-eslint10.0.1 · 1×
babel-loader8.0.6 · 1×

For agents

$ claude mcp add spritejs \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact