如果能的华,怎么画啊,跪求了
1 回答
![?](http://img1.sycdn.imooc.com/545865620001c45402760276-100-100.jpg)
慕容森
TA贡献1853条经验 获得超18个赞
用canvas大致画了一个。有点差异,具体的效果可以自己改
var c = document.getElementById("myCanvas"); var ctx = c.getContext("2d"); var clg = ctx.createLinearGradient(0, 0, 0, -640); ctx.fillStyle = "#fc3"; ctx.fillRect(0, 0, 719, 1280); ctx.strokeStyle = "transparent"; ctx.fillStyle = clg; draw(23); ctx.translate(360, 640); ctx.fillStyle = "#fc3"; ctx.beginPath(); ctx.arc(0, 0, 25, 0, 2 * Math.PI); ctx.closePath(); ctx.stroke(); ctx.fill(); ctx.translate(-360, -640); function draw(n) { for (var i = 0; i < n; i ++) { ctx.translate(360, 640); ctx.rotate(2 * Math.PI / n * i); clg.addColorStop(0.6, "#ff6"); clg.addColorStop(0.9, "#fc3"); ctx.beginPath(); ctx.moveTo(0, 0); ctx.lineTo(-50, -640); ctx.lineTo(50, -640); ctx.closePath(); ctx.stroke(); ctx.fill(); ctx.rotate(-2 * Math.PI / n * i); ctx.translate(-360, -640); }; };
添加回答
举报
0/150
提交
取消