Skip to content

Instantly share code, notes, and snippets.

@leemark
Created December 19, 2013 06:42
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 leemark/8035297 to your computer and use it in GitHub Desktop.
Save leemark/8035297 to your computer and use it in GitHub Desktop.
A Pen by Mark Lee.
function fibonacci(n) {
var fib = [];
for(var a=0, b=1, c=0, i=0; i<n; a=b, b=c, i++){
fib.push(a);
c = a+b;
}
return fib;
}
function makeDivs(arr){
arr.forEach(function(val){
var div = document.createElement('div');
document.body.appendChild(div);
div.style.width = val + 'px';
div.style.height = val + 'px';
});
}
makeDivs(fibonacci(18));
body{background: #000;margin:0;padding:0;overflow:hidden}
div{
background: rgba(255,255,255, .6);
position: absolute;
border-radius: 50%;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment