• Stars
    star
    164
  • Rank 230,032 (Top 5 %)
  • Language
    CSS
  • Created almost 13 years ago
  • Updated over 10 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Complex math functions for Sass

Sassy Math

Sassy Math is a tool designed to expand upon Sass and Compass's built in mathematic operations to include more advanced functions needed for complex calculations. These calculations may include mathematics based grid layouts, complex background images, advanced CSS animations, and anything else you can imagine.

Requirements

Sassy Math is a Compass extension, so make sure you have Sass and Compass Installed in order to use its awesomeness!

Install

sudo gem install sassy-math

If creating a new project

compass create <my_project> -r sassy-math

If adding to existing project, in config.rb

require 'sassy-math'

There are no partials to import! As long as Sassy Math is included in your config.rb file, you can use all of its might!

Constants

Functions

Exponents

  • exponent($base, $power_numerator, $power_denominator) - The $base raised to the given power where the power is a fraction in the form of $power_numerator / $power_denominator.
  • power($base, $power) - The $base raised to the given $power where the power is an integer or floating point number.
  • nth-root($number, $root) - The given $root of the input $number.
  • sqrt($number) - The square root of the given $number.

Logarithms

  • ln($number) - The natural log of the $number.
  • log($number) - The base 10 log of the $number

Angular

Note: Compass comes with sine (sin($radians)), cosine (cos($radians)), and tangent (tan($radians)) functions already, so they aren't included as part of Sassy Math.

General

  • deg-to-rad($degrees) - Returns the $degrees in radians.
  • rad-to-deg($radians) - Returns the $radians in degrees (unitless).

Inverse Trigonometric

  • asin($radians) - Arcsine of $radians. Constrained to the domain -1 ≤ $radians ≤ 1.
  • acos($radians) - Arccosine of $radians. Constrained to the domain -1 ≤ $radians ≤ 1.
  • atan($radians) - Arctangent of $radians.
  • atan2($y, $x) - Arctangent given $x and $y.

Hyperbolic

  • sinh($radians) - Hyperbolic sine of $radians.
  • cosh($radians) - Hyperbolic cosine of $radians.
  • tanh($radians) - Hyperbolic tangent of $radians.

Inverse Hyperbolic

  • asinh($radians) - Hyperbolic arcsine of $radians.
  • acosh($radians) - Hyperbolic arccosine of $radians. Constrained to the domain $radians < 1.
  • atanh($radians) - Hyperbolic arctangent of $radians. $radians cannot equal ±1.

Miscellaneous

  • factorial($number) - The factorial of the $number.
  • random($max) — Random number. The default max is 100 but you can specify whatever you want.
  • hypot($a, $b) - Returns the hypotenuse of a right-angled triangle given sides $a and $b

Comparative

  • is-int($number) - Determines whether or not the $number is an integer. Returns true or false.
  • is-float($number) - Determines whether or not the $number is a floating point number. Returns true or false.

License

Copyright (c) 2012 Sam Richard, Mario Valencia and Scott Kellum

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

breakpoint

Really simple media queries in Sass
CSS
2,091
star
2

Singularity

Grids without limits
CSS
1,504
star
3

toolkit

Toolkit for Responsive Web Design and Progressive Enhancement with Compass
CSS
912
star
4

color-schemer

A sassy way to build color schemes
CSS
376
star
5

SassyLists

SCSS
275
star
6

jacket

Conditional Styles with Sass. Dress you CSS appropriately.
CSS
232
star
7

animation-studio

Compass extension for creating advanced animations in CSS
JavaScript
184
star
8

node-sass-import-once

Eyeglass style Import Once, but for all the things!
CSS
94
star
9

Sassy-Maps

Map helper functions for Sass 3.3 and up
CSS
66
star
10

sass-a11y

Accessibility helpers for Sass
CSS
56
star
11

Singularity-extras

singularity-extras
CSS
49
star
12

SUCKS

It's an idea, it's a way of working, it's full of stars. No really, it's about Sass'd Up Consistently Killer Styles. OOCSS, SMACSS and BEM only take you so far. Let's turn it up to 11 and change the world forever!
42
star
13

Sassy-Strings

Advanced string handling for Sass
Ruby
41
star
14

Compass-Extension-Template

A generic template for creating a Compass extension
Ruby
38
star
15

sassytextshadow

Sassy Text Shadow is a Sass mixin that calculates convoluted curvy shadows for css3 text-shadow. It can also be used for box-shadow if you're into that kind of thing.
Ruby
33
star
16

Style-Sites

A responsive style page for style tiles and generating a style guide
JavaScript
32
star
17

navigator

A Ruby testing framework for Sass with Compass
Ruby
12
star
18

generator-compass-extension

Yeoman Generator to create Compass Extensions
JavaScript
11
star
19

uikit

Beautiful and flexable UIs with Sass and Compass
Ruby
9
star
20

canisass

A website to show what features are available in each version of Sass
8
star
21

griddle

Simple set of abstractions for CSS Grid
CSS
6
star
22

try

Sass Mixins for designing in the browser
CSS
2
star
23

yolo

lulz
CSS
2
star
24

Compass-Test-Suite

A generic test suite for Compass extensions
Ruby
1
star