0
使用此代碼我嘗試在imageUpdated爲true時更新繪製圖像的畫布。
我使用時間標記,因此圖像未從瀏覽器緩存中加載。
但是,當我使用時間標籤畫布保持空白。 它沒有時間標籤。當image.src具有時間標記時更新畫布圖像
var imageUpdated = true;
if(imageUpdated)
{
imageUpdated = false;
var heightImg = new Image;
heightImg.src = '/path/to/image.png?' + new Date().getTime().toString();
this.canvas = $('<canvas />')[0];
this.canvas.width = this.width;
this.canvas.height = this.height;
this.canvas.getContext('2d').drawImage(heightImg, 0, 0, this.width, this.height);
}
/*rest of event happens here*/
謝謝!
這並獲得成功,謝謝! –