阅读(3924) (2)

Cax 在Web中使用

2018-06-21 11:11:10 更新

一分钟入门 Web cax 使用

通过 npm 或者 CDN 获取:

npm i cax

import cax from 'cax'


const stage = new cax.Stage(200, 200, '#renderTo')
const rect = new cax.Rect(100, 100, {
  fillStyle: 'black'
})


stage.add(rect)
stage.update()

除了 Stage 构造函数比小程序第四个参数 this,其他使用方式都一样。