Skip to content

Instantly share code, notes, and snippets.

@Tiim
Created October 26, 2012 13:52
Show Gist options
  • Save Tiim/3958945 to your computer and use it in GitHub Desktop.
Save Tiim/3958945 to your computer and use it in GitHub Desktop.
Zooming
g.translate(getTranslateX(), getTranslateY());
g.translate(-viewport.width / 2, -viewport.height / 2);
g.scale(getZoom(), getZoom());
g.translate((viewport.width / 2) * getZoom(), (viewport.height / 2) * getZoom());
// As soon as getZoom() is not 1.00, it breaks!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment