Coder Social home page Coder Social logo

dev-itsheng / g Goto Github PK

View Code? Open in Web Editor NEW

This project forked from antvis/g

0.0 0.0 0.0 92.39 MB

💥 A flexible rendering engine for visualization.

Home Page: https://g.antv.antgroup.com/

JavaScript 26.36% Rust 0.04% TypeScript 67.44% CSS 0.01% HTML 4.78% GLSL 1.36%

g's Introduction

English | 简体中文

G

CI Coverage Status

npm package npm downloads Percentage of issues still open PRs Welcome

As the underlying rendering engine of AntV, G is dedicated to provide consistent and high performance 2D / 3D graphics rendering capabilities for upper layer products, adapting all underlying rendering APIs (Canvas2D / SVG / WebGL / WebGPU / CanvasKit / Node.js) on the web side. In particular, it provides GPGPU support for algorithms suitable for parallel computing in graph scenarios.

✨ Features

Easy-to-use API。The graphics and event system is compatible with DOM Element & Event API, and the animation system is compatible with Web Animations API, which can be adapted to the existing ecosystem of Web side such as D3, Hammer.js gesture library, etc. at a very low cost.

Support multiple rendering environments。Support Canvas2D / SVG / WebGL / WebGPU / CanvasKit and runtime switching, and also server-side rendering.

High performance rendering and computing。WebGPU-based GPGPU support for parallelizable algorithms. webgpu-graph is a library of graph analysis algorithms using GPU acceleration.

Extensible plug-in mechanism and rich set of plug-ins:

📦 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, CanvasEvent } 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: {
        cx: 100,
        cy: 100,
        r: 50,
        fill: 'red',
        stroke: 'blue',
        lineWidth: 5,
    },
});

canvas.addEventListener(CanvasEvent.READY, function () {
    // 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 [email protected]: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/spec/api.html.

Run test cases

Build and run test cases:

$ yarn build
$ yarn test

Run site demos

$ cd ./site
$ yarn install
$ cd ../
$ yarn link-site

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.