let str = info;
        let c = document.createElement("canvas");
        document.body.appendChild.c;
        let ctx = c.getContext("2d");
        ctx.font = "14px Arial";
        let gradient = ctx.createLinearGradient(0, 0, c.width, 0);
        gradient.addColorStop("1", "rgba(0,0,0,0.1)");
        ctx.fillStyle = gradient;
        ctx.setTransform(0.9, -0.4, 0.5, 1, 5, 60);
        ctx.fillText(str, 0, 40);
        let imgsrc = c.toDataURL("image/png");
        let a = document.getElementById('box');
        a.style.background = "url(" + imgsrc + ") 0/30%,url(" + imgsrc + ") 25%/30%";
posted on 2022-02-10 10:57  ljyyjj  阅读(69)  评论(0编辑  收藏  举报