css-recipe-math

UNMAINTAINED - Some Math functions for Sass using plain Sass


Keywords
css-recipes, css-recipe, css, recipes, recipe, math
License
MIT
Install
bower install css-recipe-math

Documentation

Math Build Status

Some Math functions for Sass using plain Sass

Getting Started

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.

Component purpose

/!\ This recipe is available as Sass (scss) only.

It brings you some math functions like pow, sqrt, cos, sin etc.

Sass mixin(s)

Available functions

  • 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 computing
  • crp-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.

Usage examples

Sass use

This recipes requires Sass ~3.2.0 or libsass ~0.?

Mixins use
.org-Component {
    @include crp-Math(...);
}

Release History

  • 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