Created
June 1, 2017 12:34
-
-
Save RayLuxembourg/a0e1ba29217b890275d504f736809cbc to your computer and use it in GitHub Desktop.
golden ratio
This file contains hidden or 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
const spacingFactor = 8; | |
export const spacing = { | |
space0: `${computeGoldenRatio(spacingFactor, 0)}px`, // 8 | |
space1: `${computeGoldenRatio(spacingFactor, 1)}px`, // 13 | |
space2: `${computeGoldenRatio(spacingFactor, 2)}px`, // 21 | |
space3: `${computeGoldenRatio(spacingFactor, 3)}px`, // 34 | |
space4: `${computeGoldenRatio(spacingFactor, 4)}px`, // 55 | |
space5: `${computeGoldenRatio(spacingFactor, 5)}px`, // 89 | |
}; | |
function computeGoldenRatio(spacingFactor, exp) { | |
return Math.round(spacingFactor * Math.pow(1.618, exp)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment