Created
November 5, 2018 01:45
-
-
Save jinan-kordab/6b586ce743ef64156749f6c48f761d16 to your computer and use it in GitHub Desktop.
Phi golden ratio JavaScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function computeGoldenRatio(widthOrHeight) { | |
if (!widthOrHeight) { | |
return {}; | |
} | |
return { | |
width: widthOrHeight, | |
right: Math.round(widthOrHeight/ 1.61803), | |
total: Math.round(widthOrHeight* 1.61803), | |
left: widthOrHeight- Math.round(widthOrHeight/ 1.61803) | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment