Skip to content

Instantly share code, notes, and snippets.

@chriseppstein
Created July 9, 2012 23:02
Show Gist options
  • Star 28 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save chriseppstein/8615d6dc847e10c72fe5 to your computer and use it in GitHub Desktop.
Save chriseppstein/8615d6dc847e10c72fe5 to your computer and use it in GitHub Desktop.
=rotated-text($num-letters: 100, $angle-span: 180deg, $angle-offset: 0deg)
$angle-per-char: $angle-span / $num-letters;
@for $i from 1 through $num-letters
.char#{$i}
+transform(rotate($angle-offset + $angle-per-char * $i))
@bookcasey
Copy link

Chris,

Just a quick heads up: this is listed as an .scss, while it's closer to validating as .sass if you remove the semicolon in lin e 2. Otherwise it's missing some curly brackets, etc.

@rachelnabors
Copy link

For future reference, this is what the .scss version would look like:

@mixin rotated-text($num-letters: 100, $angle-span: 180deg, $angle-offset: 0deg) {
$angle-per-char: $angle-span / $num-letters;
@for $i from 1 through $num-letters {
.char#{$i} {
@include transform(rotate($angle-offset + $angle-per-char * $i))
}
}
}

@anied
Copy link

anied commented Sep 21, 2023

@rachelnabors comment, formatted:

@mixin rotated-text($num-letters: 100, $angle-span: 180deg, $angle-offset: 0deg) {
  $angle-per-char: $angle-span / $num-letters;

  @for $i from 1 through $num-letters {
    .char#{$i} {
      @include transform(rotate($angle-offset + $angle-per-char * $i))
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment