2020
09-24
09-24
js实现文字头像的生成代码
使用canvas画出文字就好啦functiongen_text_img(size,s){letcolors=["rgb(239,150,26)",'rgb(255,58,201)',"rgb(111,75,255)","rgb(36,174,34)","rgb(80,80,80)"];letcvs=document.createElement("canvas");cvs.setAttribute('width',size[0]);cvs.setAttribute('height',size[1]);letctx=cvs.getContext("2d");ctx.fillStyle=colors[Math.floor(Math.random()*(colors.length))];ctx.fillRect(0,0,...
继续阅读 >