日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

微信小程序canvas实现画圆圈头像

發(fā)布時間:2024/1/8 编程问答 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 微信小程序canvas实现画圆圈头像 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
//獲取用戶設(shè)備信息 wx.getSystemInfo({success: function (res) {_this.setData({screenHeight: res.windowHeight,screenWidth: res.windowWidth,});} }); 網(wǎng)上的圖片要先下載到本地 var _this = thiswx.getImageInfo({ // 小程序獲取圖片信息APIsrc:這是你網(wǎng)上的圖片,success: function (res) {_this.setData({headImg: res.path})}})}} }); var avatarUrl = that.data.headImg var unit = that.data.screenWidth / 375 context.save() context.beginPath()/*x: 頭像起始位置 橫坐標(biāo)y: 頭像起始位置 縱坐標(biāo)w: 頭像寬度h: 頭像高度,不傳為w*/context.arc(x+w/2, y+h/2, w/2, 0, Math.PI * 2); context.arc(unit * 164+(unit * 50)/2,unit * 15+(unit * 50)/2, (unit * 50)/2, 0, 2*Math.PI) context.clip() context.drawImage(avatarUrl,x, y,w,h) context.drawImage(avatarUrl,unit * 164, unit * 15, unit * 50, unit * 50) context.restore()

總結(jié)

以上是生活随笔為你收集整理的微信小程序canvas实现画圆圈头像的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。