update
This commit is contained in:
parent
e0e5788ba1
commit
d3103d5f7b
@ -1,18 +1,14 @@
|
|||||||
```
|
```
|
||||||
let rem = parseFloat($("html").css("font-size"))
|
|
||||||
let width = 17.25 * rem
|
|
||||||
var canvas2 = document.createElement("canvas");
|
var canvas2 = document.createElement("canvas");
|
||||||
var _canvas = document.getElementById('app');
|
var _canvas = document.getElementById('app');
|
||||||
var w = parseInt(window.getComputedStyle(_canvas).width);
|
var w = parseInt(window.getComputedStyle(_canvas).width);
|
||||||
var h = parseInt(window.getComputedStyle(_canvas).height);
|
var h = parseInt(window.getComputedStyle(_canvas).height);
|
||||||
//将canvas画布放大若干倍,然后盛放在较小的容器内,就显得不模糊了
|
//将canvas画布放大若干倍,然后盛放在较小的容器内,就显得不模糊了
|
||||||
var times = 3;
|
var times = 3;
|
||||||
// var times = 20;
|
|
||||||
canvas2.width = w * times * window.devicePixelRatio;
|
canvas2.width = w * times * window.devicePixelRatio;
|
||||||
canvas2.height = h * times * window.devicePixelRatio;
|
canvas2.height = h * times * window.devicePixelRatio;
|
||||||
canvas2.style.width = w + "px";
|
canvas2.style.width = w + "px";
|
||||||
canvas2.style.height =h + "px";
|
canvas2.style.height =h + "px";
|
||||||
console.log(w,h)
|
|
||||||
var context = canvas2.getContext("2d");
|
var context = canvas2.getContext("2d");
|
||||||
context.scale(times, times);
|
context.scale(times, times);
|
||||||
console.log(canvas2.style.width)
|
console.log(canvas2.style.width)
|
Loading…
Reference in New Issue
Block a user