I was wondering how I can make my canvas resize along with my browser window? As it is right now, using innerWidth and innerHeight, it will only size to the initial browser width and height. How do I make it expand with the browser?
Edit: Is there a way to do this without clearing the canvas?
JS
canvas.onmousemove = draw;
var ctx = canvas.getContext('2d');
var video = document.createElement("video");
video.setAttribute("src", "some_video.mp4");
video.autoplay = true;
var img2 = new Image;
img2.src = "some_image.png";
ctx.canvas.width = window.innerWidth;
ctx.canvas.height = window.innerHeight;
function draw(e){
var rect = canvas.getBoundingClientRect();
var x = e.clientX-rect.left-img2.width/2;
var y = e.clientY-rect.top-img2.height/2;
ctx.drawImage(video, x, y, 830, 644);
ctx.drawImage(img2, x, y, img2.width, img2.height);
}
Having ajax request like: $.ajax({ type: 'POST', url: 'mysite/action', dataType: 'json', data: postData, success: function(response) { console.log(response); var input = $('<a ...
Having ajax request like: $.ajax({ type: 'POST', url: 'mysite/action', dataType: 'json', data: postData, success: function(response) { console.log(response); var input = $('<a ...
I'm trying to loop through nested arrays to determine if an element in the array is either "open" or "senior": function openOrSenior(data) { for (let i = 0; i <= data.length; i++) { let ...
I'm trying to loop through nested arrays to determine if an element in the array is either "open" or "senior": function openOrSenior(data) { for (let i = 0; i <= data.length; i++) { let ...
I have this array air_content: '', compaction_method: 1, concrete_cylinders: [ { id: '', specimen_name: 'A', mould_number: '', curing: 1, age: 7 }, { ...
I have this array air_content: '', compaction_method: 1, concrete_cylinders: [ { id: '', specimen_name: 'A', mould_number: '', curing: 1, age: 7 }, { ...
I'm using angular-nvd3 directive for making a custom line chart display counting number of guest in specific period time range as follow : current Time - 2 --> current Time : will be display as ...
I'm using angular-nvd3 directive for making a custom line chart display counting number of guest in specific period time range as follow : current Time - 2 --> current Time : will be display as ...