4
我通過畫布將圖像裁剪成三角形,現在我想在它外面添加一個陰影。如何去做呢?用於畫布的裁剪區域外的Dropshadow
canvas1_img.src = "images/postcard.jpg";
var canvas_wd = 1600;
var canvas_ht = 1000;
var y1 = 330;
var y2 = 682;
canvas1.beginPath();
canvas1.moveTo(0, y1);
canvas1.lineTo(0, y2);
canvas1.lineTo(canvas_wd, canvas_ht);
canvas1.lineTo(canvas_wd, 0);
canvas1.closePath();
canvas1.clip();
canvas1.drawImage(canvas1_img,0,0);