sassy-math 0.1.1 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/sassy-math.gemspec +1 -1
- data/stylesheets/_math.scss +29 -28
- metadata +2 -2
data/sassy-math.gemspec
CHANGED
data/stylesheets/_math.scss
CHANGED
@@ -5,8 +5,8 @@
|
|
5
5
|
//////////////////////////////
|
6
6
|
// Variables
|
7
7
|
//////////////////////////////
|
8
|
-
$pi:
|
9
|
-
$π: pi
|
8
|
+
$pi: 3.1415926535897932384626433832795028841971693993751;
|
9
|
+
$π: $pi;
|
10
10
|
$e: 2.71828182845904523536028747135266249775724709369995;
|
11
11
|
|
12
12
|
$iter: 50;
|
@@ -28,6 +28,20 @@ $iter: 50;
|
|
28
28
|
@return $number * 0.01;
|
29
29
|
}
|
30
30
|
|
31
|
+
//////////////////////////////
|
32
|
+
// Golden Ratio
|
33
|
+
//////////////////////////////
|
34
|
+
@function golden() {
|
35
|
+
@return 1/2 + sqrt(5) / 2;
|
36
|
+
}
|
37
|
+
@function ϕ() {
|
38
|
+
@return golden();
|
39
|
+
}
|
40
|
+
|
41
|
+
$golden: golden();
|
42
|
+
$gold: $golden;
|
43
|
+
$ϕ: $golden;
|
44
|
+
|
31
45
|
//////////////////////////////
|
32
46
|
// Exponent
|
33
47
|
//////////////////////////////
|
@@ -102,29 +116,7 @@ $iter: 50;
|
|
102
116
|
// Basic Trig Functions
|
103
117
|
//////////////////////////////
|
104
118
|
|
105
|
-
//
|
106
|
-
|
107
|
-
//@function sin($number, $unit: 'deg') {
|
108
|
-
// @if $unit == 'deg' {
|
109
|
-
// $number: deg-to-rad($number);
|
110
|
-
// }
|
111
|
-
// @return maclaurin($number, 3, $number);
|
112
|
-
//}
|
113
|
-
//
|
114
|
-
//@function cos($number, $unit: 'deg') {
|
115
|
-
// @if $unit == 'deg' {
|
116
|
-
// $number: deg-to-rad($number);
|
117
|
-
// }
|
118
|
-
// @return maclaurin(1, 2, $number);
|
119
|
-
//}
|
120
|
-
//
|
121
|
-
// Trig Identity: Tangent = Sine divided by Cosine.
|
122
|
-
//@function tan($number, $unit: 'deg') {
|
123
|
-
// @if $unit == 'deg' {
|
124
|
-
// $number: deg-to-rad($number);
|
125
|
-
// }
|
126
|
-
// @return sin($number) / cos($number);
|
127
|
-
//}
|
119
|
+
// Bundled in compass: http://compass-style.org/reference/compass/helpers/trig/
|
128
120
|
|
129
121
|
//////////////////////////////
|
130
122
|
// Reciprocal Trig Functions
|
@@ -245,11 +237,20 @@ $iter: 50;
|
|
245
237
|
}
|
246
238
|
}
|
247
239
|
|
240
|
+
@function root($number, $n) {
|
241
|
+
@return n-root($number, $n);
|
242
|
+
}
|
243
|
+
|
248
244
|
// Square Roots
|
249
245
|
@function √($number) {
|
250
|
-
@return
|
246
|
+
@return sqrt($number);
|
251
247
|
}
|
252
248
|
|
253
249
|
@function sqrt($number) {
|
254
|
-
|
255
|
-
|
250
|
+
$guess: rand();
|
251
|
+
$root: $guess;
|
252
|
+
@for $i from 1 through $iter {
|
253
|
+
$root: $root - (pow($root, 2) - $number) / (2 * $root);
|
254
|
+
}
|
255
|
+
@return $root;
|
256
|
+
}
|