I was wondering how I could go about making a camera-like view where I could scroll a level within a canvas element just like this:
http://playbiolab.com/
>
I've always found it's more efficient to wrap your canvas in a div with the width and height of your viewport and the overflow set to hidden then just draw your whole canvas and scroll the div to where you where you want to view.
So the html would be:
and the javascript would be something like
function scrollWrapper(x, y){
var wrapper = document.getElementById('wrapper');
wrapper.scrollTop = x;
wrapper.scrollLeft = y;
}
Then just call the function with the x and y you want to view. you could wrap it in a setTimeout or something if you wanted to move there instead of just jumping there.