为了账号安全,请及时绑定邮箱和手机立即绑定

求助,这张背景图能否用css画出来啊?

求助,这张背景图能否用css画出来啊?

慕的地8271018 2018-08-13 10:09:08
如果能的华,怎么画啊,跪求了
查看完整描述

1 回答

?
慕容森

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);
    };    
};


查看完整回答
反对 回复 2018-09-19
  • 1 回答
  • 0 关注
  • 628 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信