« CSS magnifying glass 2 | Main | She's a real left winger »

God bows to math

Ever wondered how to draw a Fibonacci spiral using only CSS and JavaScript? Well, wonder no more. If you want to change the amount of the spiral that's visible, add a parameter 'scale' to the URL. Well, it's actually an approximation to a spiral made by drawing sections of circles, but who's going to notice? (Fibonacci number generator found at LiteratePrograms.)

Here's a simple logarithmic spiral. Change a and b in the URL to alter its appearance. It becomes quite dull as b approaches 0. Update: try pressing the cursor keys while looking at the spiral. Negative values of b are kind of fun.

Judge for yourself which of these spirals best represents a nautilus shell.

Comments

I see you're developing your DOM fu at the moment. Very cool.

However, it's not very accessible. ;-)

I wonder if the keyboard-operated one would fail WCAG because it can't be used with a mouse?

PS I like 'DOM fu'.

I thought I was the only one dull enough to be interested in this (my site layout all corresponds to the golden ratio). Nice work Jim.

Post a comment