跳到主要内容

视口旋转

示例加载中…

源码
import { addPanel } from '/demo-runtime.ts';

import { Graph } from '@antv/g6';

fetch('https://assets.antv.antgroup.com/g6/force.json')
  .then((res) => res.json())
  .then((data) => {
    const graph = new Graph({
      container: 'container',
      data,
      layout: {
        type: 'force',
      },
    });

    graph.render();

    addPanel((gui) => {
      const animation = {
        duration: 500,
        easing: 'linear',
      };
      const config = {
        clockwise: () => graph.rotateBy(-10, animation),
        anticlockwise: () => graph.rotateBy(10, animation),
      };
      gui.add(config, 'clockwise').name('🔁 Clockwise');
      gui.add(config, 'anticlockwise').name('🔄 Anti-clockwise');
    });
  });
全站搜索
文档与示例输入关键词开始搜索

输入关键词,查找文档、API 与示例

↑↓选择↵打开Esc关闭