Some Math functions for Sass using plain Sass
If you haven't used css-recipes before, be sure to check out the Getting Started guide, as it explains consume the recipes using Bower. Once you're familiar with that process, you may install this recipe with this command:
bower install css-recipe-math --save
Once the recipe has been installed (& assuming bower_components
folder is in your Sass import paths), it may be enabled inside your Sass file with this line:
@import "css-recipe-math/index"
Read more below to find alternative way to use this recipe.
/!\
This recipe is available as Sass (scss) only.
It brings you some math functions like pow, sqrt, cos, sin etc.
crp-Math-pow($x, $exponent)
crp-Math-factorial($x)
crp-Math-exp($x)
crp-Math-ln($x, $dx: auto)
auto set to 0.001 & adjust with big numbers to avoid slow computingcrp-Math-sqrt($x)
Note: Due to a Sass limitation, some functions (exp) return approximations according to the limit $crp-Math-approximationLimit
(default to 10) to avoid infinite calculations. That said, it should be enough for playing with pixels.
This recipes requires Sass ~3.2.0
or libsass ~0.?
.org-Component {
@include crp-Math(...);
}
- 2013-09-12 v0.1.1 Change sqrt() algorithm + faster ln().
- 2013-09-10 v0.1.0 First release with everything needed for sqrt().
Recipe submitted by "MoOx" Maxime Thirouin