Skip to content

Instantly share code, notes, and snippets.

@leonderijke
Created December 4, 2014 15:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leonderijke/b0a1d4e656b743910156 to your computer and use it in GitHub Desktop.
Save leonderijke/b0a1d4e656b743910156 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.4.7)
// Compass (v1.0.1)
// ----
$pi: 3.14159265359;
@function pow($base,$exp){
$value: $base;
@if $exp > 1{
@for $i from 2 through $exp{
$value: $value * $base;
}
}
@if $exp < 1{
@for $i from 0 through -$exp{
$value: $value / $base;
}
}
@return $value;
}
@function fact($val){
$value: 1;
@if $val > 0{
@for $i from 1 through $val{
$value: $value * $i;
}
}
@return $value;
}
@function sin($angle, $degrees: false){
$sin: 0;
@if $degrees{
$angle: $angle / 180 * $pi;
}
@for $n from 1 through 10{
$sin: $sin + ( pow(-1,$n) / fact(2*$n+1) ) * pow($angle,(2*$n+1));
}
@return $sin;
}
@function cos($angle, $degrees: false){
$cos: 0;
@if $degrees{
$angle: $angle / 180 * $pi;
}
@for $n from 1 through 10{
$cos: $cos + ( pow(-1,$n) / fact(2*$n) ) * pow($angle,2*$n);
}
@return $cos;
}
@function tan($angle, $degrees: false){
@if $degrees{
$angle: $angle / 180 * $pi;
}
$tan: sin($angle) / cos($angle);
@return $tan;
}
$width: 100px;
$height: 300px;
$top-height: 70px;
$bottom-height: $height - $top-height;
$angle: 10;
$x: ( -$height - $top-height ) / (tan($angle) + ($top-height / $width));
$y: ($height / $width) * $x - $height;
.Foo {
x: $x;
y: $y;
t: tan($angle, true);
}
.Foo {
x: 640.21744px;
y: 1620.65231px;
t: 0.05824;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment