Created
May 24, 2015 13:36
-
-
Save king-panda/e7727d1b97025532a80f to your computer and use it in GitHub Desktop.
【Sass】フィボナッチ数列の第n項を求めるカスタム関数 ref: http://qiita.com/kingpanda/items/8e6a4a382e13d1feafd2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@function 自作関数名($引数){ | |
@return 戻り値; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@function fib($value){ | |
@return f(1, 1, $value); | |
} | |
@function f($a, $b, $c){ | |
@if $c <= 2 { | |
@return $a; | |
} | |
@return f($a + $b, $a, $c - 1); | |
} | |
div{ | |
width: fib(7)px; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
div { width: 13px; } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment