Sha256: 1c237fdf2c68754b9ee4715931b8699266e7c17ca28582d94c15dca6a5eca0b0

Contents?: true

Size: 1.06 KB

Versions: 5

Compression:

Stored size: 1.06 KB

Contents

// centralize spiral steps.
@function ratio-spiral-i($i) {
  @return (($i * 2) + 1);
}

@function ratio-spiral($depth: 5, $ratio: golden(), $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));
      }
    }
  }

  @if $singularity-debug {
    @debug "Grid compounded to #{length($list)} columns";
  }

  @return $list;
}

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
singularitygs-1.0.alpha.2 stylesheets/singularitygs/grid-plugins/_ratio-spiral.scss
singularitygs-1.0.alpha.1 stylesheets/singularitygs/grid-plugins/_ratio-spiral.scss
singularitygs-1.0.alpha.0 stylesheets/singularitygs/grid-plugins/_ratio-spiral.scss
singularitygs-0.0.17 stylesheets/singularitygs/grid-plugins/_ratio-spiral.scss
singularitygs-0.0.16 stylesheets/singularitygs/grid-plugins/_ratio-spiral.scss