All Projects → terkel → Mathsass

terkel / Mathsass

Licence: mit
A Sass implementation of mathematical functions.

Projects that are alternatives of or similar to Mathsass

Mir
Mir (backports): Sparse tensors, Hoffman
Stars: ✭ 204 (-7.69%)
Mutual labels:  math
Mern Boilerplate
MERN stack project boilerplate
Stars: ✭ 211 (-4.52%)
Mutual labels:  sass
V Bar
The virtual responsive crossbrowser scrollbar component for VueJS 2x
Stars: ✭ 216 (-2.26%)
Mutual labels:  sass
Family.scss
Family.scss is a set of Sass mixins which will help you to manage the style of :nth-child'ified elements, in an easy way.
Stars: ✭ 2,314 (+947.06%)
Mutual labels:  sass
Hubuntu Ui
Material Admin Dashboard Starter UI ( Ubuntu style ) - https://720kb.github.io/hubuntu-ui/
Stars: ✭ 207 (-6.33%)
Mutual labels:  sass
Aquila
🎨 An Advanced WordPress theme
Stars: ✭ 204 (-7.69%)
Mutual labels:  sass
Barekit
A bare minimum responsive framework
Stars: ✭ 201 (-9.05%)
Mutual labels:  sass
Mathutilities
A collection of some of the neat math and physics tricks that I've collected over the last few years.
Stars: ✭ 2,815 (+1173.76%)
Mutual labels:  math
React Native Css Modules
Style React Native components using CSS, PostCSS, Sass, Less or Stylus.
Stars: ✭ 207 (-6.33%)
Mutual labels:  sass
Griddle
A CSS Grid Framework
Stars: ✭ 215 (-2.71%)
Mutual labels:  sass
Katex
Fast math typesetting for the web.
Stars: ✭ 14,623 (+6516.74%)
Mutual labels:  math
Django Static Precompiler
Django Static Precompiler provides template tags and filters to compile CoffeeScript, LiveScript, SASS / SCSS, LESS, Stylus, Babel and Handlebars. It works with both inline code and external files.
Stars: ✭ 206 (-6.79%)
Mutual labels:  sass
Style Resources Loader
CSS processor resources loader for webpack
Stars: ✭ 214 (-3.17%)
Mutual labels:  sass
Csharpmath
LaTeX. in C#. (ported from the wonderful iosMath project).
Stars: ✭ 205 (-7.24%)
Mutual labels:  math
Tutorials
AI-related tutorials. Access any of them for free → https://towardsai.net/editorial
Stars: ✭ 204 (-7.69%)
Mutual labels:  math
Jekyll Doc Theme
Jekyll theme for creating project documentation websites
Stars: ✭ 203 (-8.14%)
Mutual labels:  sass
Vue Foundation
VueJS + Foundation + Vue-Router + Webpack
Stars: ✭ 212 (-4.07%)
Mutual labels:  sass
Mathnet Numerics
Math.NET Numerics
Stars: ✭ 2,688 (+1116.29%)
Mutual labels:  math
Themify
👨‍🎨 CSS Themes Made Easy. A robust, opinionated solution to manage themes in your web application
Stars: ✭ 218 (-1.36%)
Mutual labels:  sass
Aspnetcore Vue Typescript Template
Template AspNetCore with Vue, Vue router, Vuex, TypeScript, Bulma, Sass and Jest
Stars: ✭ 215 (-2.71%)
Mutual labels:  sass

MathSass NPM version Build Status Dependency Status devDependency Status

A Sass implementation of mathematical functions.

Install

Git

git clone [email protected]:terkel/mathsass.git && cd mathsass

Bower

bower install mathsass --save-dev

npm

npm install mathsass --save-dev

Usage

Import dist/_math.scss partial to the Sass document.

@import "path/to/dist/math";

.content {
    height: 200px;
    width: 200px / tan(60deg); // 115.47005px
}

If you installed via Npm the path will be: node_modules/mathsass/dist/math

If you installed via Bower the path will be: bower_components/mathsass/dist/math

Features

Constants

  • $E - Euler's constant (ネイピア数 [オイラー数])
  • $PI - π (円周率)
  • $LN2 - The natural logarithm of 2 (2 の自然対数)
  • $SQRT2 - The square root of 2 (2 の平方根)

Functions

Exponentiation

  • pow($base, $exp)
@debug pow(4, 2);   // 16
@debug pow(4, -2);  // 0.0625
@debug pow(4, 0.2); // 1.31951

Factorial

  • fact($x)
@debug fact(4); // 24
@debug fact(8); // 40320

Square root

  • sqrt($x)
@debug sqrt(2); // 1.41421
@debug sqrt(3); // 1.73205

Exponential function

  • exp($x)
  • frexp($x)
  • ldexp($x, $exp)
@debug exp(-1); // 0.36788
@debug exp(0);  // 1
@debug exp(1);  // 2.71828

Logarithms

  • log($x, $b: null)
@debug log(2);     // 0.69315
@debug log(10);    // 2.30259
@debug log(2, 10); // 0.30103

Trigonometric functions

  • sin($x) - Sine (正弦)
  • cos($x) - Cosine (余弦)
  • tan($x) - Tangent (正接)
  • csc($x) - Cosecant (余割)
  • sec($x) - Secant (正割)
  • cot($x) - Cotangent (余接)

If argument has deg unit, converted to rad.

@debug tan(0.5236); // 0.57735
@debug tan(30deg);  // 0.57735

Inverse trigonometric functions

  • asin($x) - Arcsine (逆正弦)
  • acos($x) - Arccosine (逆余弦)
  • atan($x) - Arctangent (逆正接)
  • atan2($y, $x) - Arctangent of the quotient of its arguments (引数の比率での逆正接)
@debug atan2(0, 0);       // 0
@debug atan2(0, -0.0);    // 3.14159
@debug atan2(-0.0, 0);    // 0
@debug atan2(-0.0, -0.0); // -3.14159

Greatest common divisor and least common multiple

  • gcd($a, $b) - Greatest common divisor (最大公約数)
  • lcm($a, $b) - Least common multiple (最小公倍数)
@debug gcd(54, 24); // 6
@debug lcm(30, 42); // 210

Helper functions

  • strip-unit($number)
  • deg-to-rad($deg, $unit: true)
  • rad-to-deg($rad, $unit: true)
  • unitless-rad($angle)
@debug rad-to-deg(1.0472);       // 60.00014deg
@debug deg-to-rad(60deg);        // 1.0472rad
@debug deg-to-rad(60deg, false); // 1.0472
@debug unitless-rad(60deg);      // 1.0472
@debug unitless-rad(1.0472rad);  // 1.0472

References

…and Wikipedia articles:

Contributing

Make sure you have node.js and grunt installed.

Clone Repository

git clone [email protected]:terkel/mathsass.git

Install Dependencies

npm install

Run Sass/Tests

grunt

Credits

Originally created with help from @kaminaly and @pilssalgi.

License

Copyright (c) 2013 Takeru Suzuki Licensed under the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].