3crazyspecial / g

A powerful rendering engine implemented with Canvas2D / SVG / WebGL / WebGPU.

Home Page:https://g-next.antv.vision

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

English | 简体中文

G

npm package npm downloads npm package npm downloads Percentage of issues still open

A powerful rendering engine for AntV.

✨ Features

📦 Install

# 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

🔨 Usage

<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';
});

⌨️ Development

Start previewing site:

$ git clone git@github.com:antvis/g.git
$ cd g
$ yarn install
$ yarn start

API Spec

Start a dev-server on root dir, eg. http-server:

$ http-server -p 9090

Open api.html on localhost:9090/dev-docs/api.html.

Run test cases

Build and run test cases:

$ yarn build
$ yarn test

Inspired by

Contributors


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.

About

A powerful rendering engine implemented with Canvas2D / SVG / WebGL / WebGPU.

https://g-next.antv.vision


Languages

Language:TypeScript 76.5%Language:JavaScript 14.7%Language:HTML 5.7%Language:GLSL 1.6%Language:PEG.js 1.4%Language:Rust 0.1%Language:CSS 0.0%