English | 简体中文
A powerful rendering engine for AntV.
- Provides a series of easy-to-use APIs.
- The graphics and event systems are compatible with the DOM Element & Event API, which means we can take over the default rendering process of D3 or use gesture libs such as Hammer.js.
- The animation system is compatible with Web Animation API.
- Provides Canvas2D / SVG / WebGL / WebGPU renderers, you can choose one on demand or switch between them at runtime.
- Supports visualization scenarios with large amounts of data. In addition to high-performance rendering, we also provide GPGPU capabilities based on WebGPU.
- webgpu-graph A GPU accelerated graph analytics library.
- Provides a lot of plugins:
- Rendering
- g-plugin-canvas-renderer Renders 2D graphics with Canvas2D API.
- g-plugin-svg-renderer Render 2D graphics with SVG API.
- g-plugin-webgl-renderer Render 2D graphics with WebGL 1/2 and WebGPU API.
- g-plugin-html-renderer Provides raw HTML elements.
- g-plugin-3d Expanded 3D rendering capabilities such as Geometry, Material, Mesh and Lights.
- Picking
- g-plugin-canvas-picker Implements graphics picking with Canvas2D API.
- g-plugin-svg-picker Implements graphics picking with SVG API.
- Interaction
- g-plugin-dom-interaction Register event listeners with DOM API.
- g-plugin-control Provides controls such as orbit based on Camera.
- Physics engine
- g-plugin-box2d Based on Box2D.
- g-plugin-matterjs Based on matter.js.
- g-plugin-physx Based on PhysX.
- Layout engine
- g-plugin-yoga Based on Yoga.
- GPGPU
- g-plugin-gpgpu Provides GPGPU capabilities based on WebGPU.
- CSS select
- g-plugin-css-select Query graphics in scenegraph with CSS select syntax.
- Rendering
# Install Core
$ npm install @antv/g --save
# Canvas Renderer
$ npm install @antv/g-canvas --save
# SVG Renderer
$ npm install @antv/g-svg --save
# WebGL Renderer
$ npm install @antv/g-webgl --save
<div id="container"></div>
import { Circle, Canvas } from '@antv/g';
import { Renderer as CanvasRenderer } from '@antv/g-canvas';
// or
// import { Renderer as WebGLRenderer } from '@antv/g-webgl';
// import { Renderer as SVGRenderer } from '@antv/g-svg';
// create a canvas
const canvas = new Canvas({
container: 'container',
width: 500,
height: 500,
renderer: new CanvasRenderer(), // select a renderer
});
// create a circle
const circle = new Circle({
style: {
x: 100,
y: 100,
r: 50,
fill: 'red',
stroke: 'blue',
lineWidth: 5,
},
});
// append to canvas
canvas.appendChild(circle);
// add listener for `click` event
circle.addEventListener('click', function () {
this.style.fill = 'green';
});
Start previewing site:
$ git clone git@github.com:antvis/g.git
$ cd g
$ yarn install
$ yarn start
Start a dev-server on root dir, eg. http-server
:
$ http-server -p 9090
Open api.html on localhost:9090/dev-docs/api.html
.
Build and run test cases:
$ yarn build
$ yarn test
dengfuping |
xiaoiver |
dxq613 |
dependabot-preview[bot] |
afc163 |
zhanba |
---|---|---|---|---|---|
limichange |
entronad |
hustcc |
simaQ |
zqlu |
Deturium |
Yanyan-Wang |
elaine1234 |
visiky |
baizn |
terence55 |
budlion |
luoxupan |
Leannechn |
This project follows the git-contributor spec, auto updated at Tue Dec 07 2021 10:00:16 GMT+0800
.