D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
tmcw
Full window
Github gist
Fibonnacci Monolith
inspired by geometrydaily's fibonnacci monolith
<!DOCTYPE html> <html> <head> <title></title> <meta http-equiv='content-type' content='text/html; charset=utf-8' /> <style> body { font:normal 12px/20px 'Georgia'; text-align:center; background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAGi0lEQVRYR23YiW7jOgyFYaf79v4v2s50b25+oZ/BCa6BNrYsUVwODykfPj8/jx8fH9vNzc12ut/u7++3ru6vr6+34/G4vb29bYfDYbu9vd3vf35+toeHh+3l5WXN77q8vNyurq7W/fv7+/b09LS9vr4uOb378+fPdnd3t+Yk09zeNa8rmemT/MYPz8/Pxxa5enFxcbEe+02xr6+vJawNEvD9/b0MyKgM6Op985rP4JToap6xZDa3dc3NQPsns/vW5agl76T52qFFaZzlCfz79+8+lkJdKd+fKw+1QWvbuHUJpXSy2tA6Hk4eBVOmtRSyliGHQpzQhLQRS3tucmME8lKbtqbQZXV/PN+7PNPa5rQRmSnY1XjKF41ptAis0J5krL/T5guDLKJEk/MQrPS+P0oJb0LapHn9tobBGRZuU7L3bSxKyWlef81J4YnJ5rX+cNr0mAd6YI2JcNi4BGne4+Pjmn8unBKtt2H3rc8JyUix7lOadxtPngj2XtKtJMnVbcb9LSxUFIfPPMiI5tgY9mR2+M2TzS87W0/RxhgnOTLMfXokr8hk5MJgGsNNylJshn1mawsLARxSFn0AuESb+Ex2e6UUDCYHPlHUniQn5Y4JztIWCgGwz9DbCO30K9wzyUSid5QpjF3k8VBKYoh+eVjUlgdtnHVNQA15FhlLHpSQB9BPglPGBjBETp7sPaLmPZ5vf4WhMXJXNp8WLQVZm1eajEzhC3m3WWM9C03zPcNuwhvLYOHrOd7MaHKKWIrjYrmwezCa4e5JMd1jdcqhhizs3SxzM5wqx4RCCpQ48M045I13eQ/5H04vjuGvDRfv/JKsTJOBhYUSqgcF0ERKoBrcljxXskRHlYG5FBSt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pmz+8x3TtHFCJHAwcx2a5KiQCsasvSYR4TdgVnKw5DZXNuhwvtfO/hwwefScazW9E49F4zGmyao+7DpQZB9RLFPYvhTXY61GD1rG9DZU8D0HgbShL4ceKb3gIXBQBB8zgZmtqVmH36mJzX4OxqeoYRIVut+O8R01ibOLQ7QqASIVTmGBfehZSSstj3xJ2otUlNdLCRDL448GLvEbpMzbvG1NyJxRImo2a1ACeepcM/HzD7NqML4RWfcVnuKKn2SiRHwwmPINHzbDYQr9Pa7IqcJnOCRJtc/B/+/6EuOzLq5gAAAABJRU5ErkJggg==) #222; } a { display:block; margin-bottom:50px; } #c { -webkit-transform:rotate(180deg); } </style> </head> <body> <a href='https://geometrydaily.tumblr.com/post/42023402755/367-fibonacci-monolith-geometry-daily-is-back'>inspired by geometrydaily</a> <canvas id='c' width='400' height='700'></canvas> <script> var lim = 50, w, fibs = [], c = document.getElementById('c'), ctx = c.getContext('2d'), s5 = Math.sqrt(5); // analytic. suck it, computer science function fib(x) { return Math.round(((1 / s5) * Math.pow(((1 + s5) / 2), x)) - ((1 / s5) * Math.pow(((1 - s5) / 2), x))); } for (var i = 0; i < lim; i++) fibs.push(fib(i)); var max = fibs[lim - 1], x = 0, y = 0; colors = [ '#100f1f', '#2a445e', '#382d3e', '#7fb6ab']; for (i = lim - 1; i > 0; i--) { ctx.fillStyle = colors[i % colors.length]; w = ((fibs[i] / max) * 400); ctx.fillRect(x, y, w, w); if (i % 2 == 0) x += w; else y += w; } </script> </body> </html>