Cax 內(nèi)置 Shape 和 Element

2018-06-21 11:15 更新

Shape

與 Graphics 不同的是, Shape 一般擁有有限的寬高,所以可以使用離屏 Canvas 進(jìn)行緩存。下面這些屬于 Shape。

Rect

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

Circel

const circel = new cax.Circel(10)

Ellipse

const ellipse = new cax.Ellipse(10)

注意:從技術(shù)上小游戲和 Web 可以離屏 Canvas,小程序不行,因?yàn)樾〕绦虿恢С謩?dòng)態(tài)創(chuàng)建離屏 Canvas。

Element

Element 是多種元素的組合,如 Bitmap、Group、 Text、 Shape 等混合起來的圖像。

Button

const button = new cax.Button({
  width: 100,
  height: 40,
  text: "Click Me!"
})
以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)