Skip to content

Instantly share code, notes, and snippets.

@Accudio
Created September 22, 2021 15:25
Show Gist options
  • Select an option

  • Save Accudio/0117fa81e3c513010faaa27b980f423f to your computer and use it in GitHub Desktop.

Select an option

Save Accudio/0117fa81e3c513010faaa27b980f423f to your computer and use it in GitHub Desktop.
sizes(300, 1360, 0.15)
function sizes(start, stop, tol = 0.1) {
if (start === stop) return [start]
const resolutions = []
while (start < stop) {
resolutions.push(Math.ceil(start))
start *= 1 + tol * 2
}
if (resolutions.at(-1) < stop) {
resolutions.push(stop)
}
return resolutions
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment