第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

用ES6寫法 寫一個canvas類,頁面未生成canvas圖像

用ES6寫法 寫一個canvas類,頁面未生成canvas圖像

DIEA 2019-03-23 19:15:57
    let canvasNode = document.getElementById('canvas'),        ctxs = canvasNode.getContext("2d");    console.log(canvasNode)    class CircleProgress {        constructor(ctxs, width, height, arc) {            this.ctx = ctxs            this.ctx.canvas.width = width            this.ctx.canvas.height = width            this.arc = arc        }        clearFill() {            this.ctx.clearRect(0, 0, this.width, this.width);        }        fillBg() {            this.ctx.beginPath();            this.ctx.lineWidth = this.arc;            this.ctx.strokeStyle = '#ccc';            this.ctx.arc(this.width / 2, this.width / 2, 45, 0, 2 * Math.PI);            this.ctx.stroke();        }        fillArc(x) {            this.ctx.beginPath();            this.ctx.lineWidth = this.arc;            this.ctx.strokeStyle = '#ccc';            this.ctx.arc(this.width / 2, this.width / 2, 45, -90 * Math.PI / 180, (x * 3.6 - 90) * Math.PI / 180);            this.ctx.stroke();        }        fillText(x) {            this.ctx.font = '14px' + ' Arial';            this.ctx.fillStyle = 'red';            this.ctx.textBaseline = "middle";            this.ctx.textAlign = 'center';            this.ctx.fillText(x.toFixed(1) + '%', this.width / 2, this.width / 2);        }        fill(x) {            this.fillBg();            this.fillArc(x);            this.fillText(x);        }        testFn() {            return this.ctx        }    }    let cicle = new CircleProgress(ctxs, 100, 100, 10)    cicle.fill(100)
查看完整描述

2 回答

?
慕少森

TA貢獻(xiàn)2019條經(jīng)驗 獲得超9個贊

this.ctx.canvas.width = width

this.ctx.canvas.height = height

this.width = width

this.height = height


查看完整回答
反對 回復(fù) 2019-03-29
?
臨摹微笑

TA貢獻(xiàn)1982條經(jīng)驗 獲得超2個贊

沒有編譯吧。瀏覽器不認(rèn)識class


查看完整回答
反對 回復(fù) 2019-03-29
  • 2 回答
  • 0 關(guān)注
  • 658 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號