4 ms·
I tried to replicate the formula for the type scale and it took a bit more effort than expected. This is what I got: var scale = (n) => n ? scale(n-1) + Ma
by ricardobeat 9y ago
I tried to replicate the formula for the type scale and it took a bit more effort than expected. This is what I got:
var scale = (n) => n ? scale(n-1) + Math.ceil((n-2) / 4) * 2 : 12;
[...Array(16).keys()].map(n => scale(n+2));
Looks like the ⌊floor⌋ should actually be ⌈ceil⌉ and it only works by starting from offset 2 (base value repeats 3x in the sequence). Am I mistaken, or is the formula wrong?