0.2.9 • Published 1 year ago

visual-core v0.2.9

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

visual-core

安装

pnpm add visual-core

用法

import { Visual, VisualProperty } from 'visual-core'
// 需要另外安装visual-renderer-pixijs
import { PixiRenderer } from 'visual-renderer-pixijs'

// 新建Visual对象,需要传入一个渲染器对象
// 这里举例需要安装visual-renderer-pixijs,或是使用其他
const visual = new Visual(new PixiRenderer(document.body))

// 新建一个VisualElement对象
const element = visual.createElement()

// 激活插件
// 这里需要安装visual-plugin-drag
// 并在激活前 import 'visual-plugin-drag'
element.activePlugin('plugin:drag')

// 设置属性
element.set(VisualProperty.ROTATION, 10)

// 消活插件
element.inactivePlugin('plugin:drag')