【发布时间】:2018-05-13 12:25:13
【问题描述】:
我是 canvas 的新手,我正在尝试制作全屏游戏,更重要的是响应小屏幕 但是我的形状变得模糊,就像它们被放大了一样 这是我的 CSS 和两个 JavaScript 函数
canvas {
background: green;
width: 100%;
height: 100%;
}
//this function draws
function drawEverything() {
colorRect(0, 0, canvas.width, canvas.height, '#C9EEF3', "Main");
colorRect(50,0,150, 35, "red","firstRow");
}
// this function gives the layout of the rectangels
function colorRect(leftX, topY, width, height, drawColor, tag) {
canvasContext.fillStyle = drawColor;
canvasContext.fillRect(leftX, topY, width, height);
}
【问题讨论】:
标签: javascript css html canvas