3D extension for G
Provide some 3D shapes such as Cube, Sphere, support g-webgl
only.
Cube
import { Canvas, Group } from '@antv/g';
import { Renderer } from '@antv/g-webgl';
import { CubeGeometry, MeshBasicMaterial, Mesh, Plugin } from '@antv/g-plugin-3d';
const webglRenderer = new Renderer();
webglRenderer.registerPlugin(new Plugin());
const canvas = new Canvas({
container: 'container',
width: 600,
height: 500,
renderer: webglRenderer,
});
const geometry = new CubeGeometry({
width: 200,
height: 200,
depth: 200,
});
const material = new MeshBasicMaterial({
map: 'https://xxx.png',
});
const cube = new Mesh({
fill: '#1890FF',
opacity: 1,
style: {
geometry,
material,
},
});
canvas.appendChild(cube);
cube.translate(100, 100, 0);