title: HTML5 Canvas 2D Game Camera
body: <p>I am developing an HTML5 canvas game (2D). The canvas has a size of 2000x2000 pixels. My screen has a res of 1920x1080. I would like to make a camera object in JavaScript to imitate the camera following the player (should be the center of the viewport)</p>
  
  <p>From one of my previous games, I've used this in C# (XNA)</p>
  
  <pre><code>center = new Vector2(player.position.X + (player.rectangle.Width / 2) - (view.Width / 2), 50);
  transform = Matrix.CreateScale(new Vector3(1, 1, 0)) * Matrix.CreateTranslation(new Vector3(-center.X, -center.Y, 0));
  </code></pre>
  
  <p>Would anyone be able to help me "translate" this into JavaScript using HTML5 Canvas? I'd really appreciate it!</p>