Skip to content

Instantly share code, notes, and snippets.

@EliasTouil
Forked from anonymous/SassMeister-input.scss
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EliasTouil/4f49a4dff9d33ea1c953 to your computer and use it in GitHub Desktop.
Save EliasTouil/4f49a4dff9d33ea1c953 to your computer and use it in GitHub Desktop.
#mydiv {
width: 2.12197;
}
.cols-1 {
width: 1.12271em;
}
.cols-2 {
width: 1.1896em;
}
.cols-3 {
width: 1.26048em;
}
.cols-4 {
width: 1.33558em;
}
.cols-5 {
width: 1.41515em;
}
// ----
// Sass (v3.4.3)
// Compass (v1.0.1)
// ----
$notes:5;
//just cuz sass doesnt have enough math
@function expo($base,$exponent){
$value:$base;
@for $i from 1 through $exponent {
$value:$value*$base;
}
@return $value;
}
//the function that can give me notes in HZ
@function octarray($n){
$myarray:1;
//that loop below
@for $i from 1 through $n{
$myarray:append($myarray,expo(105958,$i)/expo(100000,$i));
//must use large number and deeevid because sass is stupid in maths and needs integers
}
$lastone: length($myarray);
//variable that knows what n i stopped at, even though it could be equal to $n, should it? whatever this works
@return nth($myarray,$lastone);
//the last value in the array, because the function will be used this way gee
}
//this is not how it will actually work, but is an example
#mydiv{
width:octarray(12);
}
//this is to make sure the loop itself gives me what i want
@for $i from 1 through $notes{
.cols-#{$i}{
width: 1* expo(105958,$i)/expo(100000,$i) +em;
}
}
//fuck the police
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment