Skip to content

Instantly share code, notes, and snippets.

@AlainBarrios
Created June 17, 2019 22:14
Show Gist options
  • Save AlainBarrios/f1c7ee958c0eb4304787eded726b3718 to your computer and use it in GitHub Desktop.
Save AlainBarrios/f1c7ee958c0eb4304787eded726b3718 to your computer and use it in GitHub Desktop.
const imageRatio = texture.width / texture.height;
const canvasRatio = innerWidth / innerHeight;
const aspecRatio =
canvasRatio > imageRatio
? [1, imageRatio / canvasRatio]
: [canvasRatio / imageRatio, 1];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment