與 Graphics 不同的是, Shape 一般擁有有限的寬高,所以可以使用離屏 Canvas 進(jìn)行緩存。下面這些屬于 Shape。
const rect = new cax.Rect(200, 100, {
fillStyle: 'black'
})
const circel = new cax.Circel(10)
const ellipse = new cax.Ellipse(10)
注意:從技術(shù)上小游戲和 Web 可以離屏 Canvas,小程序不行,因?yàn)樾〕绦虿恢С謩?dòng)態(tài)創(chuàng)建離屏 Canvas。
Element 是多種元素的組合,如 Bitmap、Group、 Text、 Shape 等混合起來的圖像。
const button = new cax.Button({
width: 100,
height: 40,
text: "Click Me!"
})
更多建議: