drawing test image into canvas (full)
idk if I won't remake this somehow differently
This commit is contained in:
parent
6d6ef0f1f3
commit
b895548bda
@ -5,11 +5,14 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="stylesheet" href="./res/style.css">
|
||||
<script src="./res/script.js"></script>
|
||||
|
||||
<title>Fabrika Hrádek Tour</title>
|
||||
</head>
|
||||
<body onload="load_panorama()">
|
||||
<div id="panorama"></div>
|
||||
<div id="panorama_div">
|
||||
<canvas id="panorama">This browser doesn't seem to support canvas. sorry idk</canvas>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -1,4 +1,18 @@
|
||||
function load_panorama()
|
||||
{
|
||||
document.getElementById("panorama").style.backgroundImage = "./img/test.jpg" //NOT WORKING
|
||||
console.log(window.width);
|
||||
var ctx = document.getElementById('panorama').getContext('2d');
|
||||
var img = new Image();
|
||||
var width_buffer;
|
||||
|
||||
img.onload = function()
|
||||
{
|
||||
width_buffer = 5000;
|
||||
|
||||
ctx.canvas.width=width_buffer;
|
||||
ctx.canvas.height=width_buffer / 2;
|
||||
ctx.drawImage(img, 0, 0, img.width, img.height, 0, 0, width_buffer, width_buffer / 2);
|
||||
};
|
||||
|
||||
img.src = './res/img/test.jpg';
|
||||
}
|
@ -1 +1,10 @@
|
||||
/*stuff*/
|
||||
#panorama
|
||||
{
|
||||
display: inline;
|
||||
}
|
||||
|
||||
#panorama_div
|
||||
{
|
||||
width: 100%;
|
||||
text-align:center;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user