W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗(yàn)值獎勵
CanvasContext.scale 用于在調(diào)用scale
方法后,之后創(chuàng)建的路徑其橫縱坐標(biāo)會被縮放。多次調(diào)用scale
,倍數(shù)會相乘。
//.js
const ctx = my.createCanvasContext('canvas');
ctx.strokeRect(10, 10, 25, 15)
ctx.scale(2, 2)
ctx.strokeRect(10, 10, 25, 15)
ctx.scale(2, 2)
ctx.strokeRect(10, 10, 25, 15)
ctx.draw()
ctx.draw()
Object 類型,屬性如下:
屬性 | 類型 | 描述 |
---|---|---|
scaleWidth | Number | 橫坐標(biāo)縮放倍數(shù) (1 = 100%,0.5 = 50%,2 = 200%)。 |
scaleHeight | Number | 縱坐標(biāo)軸縮放倍數(shù) (1 = 100%,0.5 = 50%,2 = 200%)。 |
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: