Created
March 12, 2017 06:54
-
-
Save linroex/7611997463314c6fc34ca53c0dea8a9e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 創造 img HTML 元素,並放入變數中 | |
var bgImg = document.createElement("img"); | |
// 設定這個元素的要顯示的圖片 | |
bgImg.src = "images/map.png"; | |
// 找出網頁中的 canvas 元素 | |
var canvas = document.getElementById("game"); | |
// 取得 2D繪圖用的物件 | |
var ctx = canvas.getContext("2d"); | |
function draw(){ | |
ctx.drawImage(bgImg, 0, 0); | |
} | |
setTimeout(draw, 1000); |
87 xd
☻
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks LOL