HTML5 CANVAS draw image

后端 未结 2 417
我寻月下人不归
我寻月下人不归 2020-12-31 23:26

Here is my question

I kind of not understand what is the sx and sy is for in below function

context.drawImage(Image, sx, sy, sw, sh, dx, dy, dw, dh);

<
2条回答
  •  北海茫月
    2021-01-01 00:00

    var img = new Image();
    img.onload = function init_sketch() {
    img.src = 'http://cssdeck.com/uploads/media/items/3/3yiC6Yq.jpg';
    context.drawImage(img, 0, 0);
    }
    

提交回复
热议问题