@import "modular-scale"; // centralize spiral steps. @function ratio-spiral-i($i) { @return (($i * 2) + 1); } @function ratio-spiral($depth: 5, $ratio: golden-ratio(), $invert: false) { // write the middle most column, a little out of step from the other columns. $list: ms(ratio-spiral-i(-$depth) + 1, 100, $ratio); // flip the direction the order columns are written in. @if $invert == false { @for $i from -($depth - 1) to 0 { // if the number is even @if $i/2 == round($i/2) { // append after the list $list: append($list, ms(ratio-spiral-i($i), 100, $ratio)); } @else { // append before the list $list: append(ms(ratio-spiral-i($i), 100, $ratio), $list); } } } @else { @for $i from -($depth - 1) to 0 { @if $i/2 == round($i/2) { $list: append(ms(ratio-spiral-i($i), 100, $ratio), $list); } @else { $list: append($list, ms(ratio-spiral-i($i), 100, $ratio)); } } } @return $list; }