For the interested.
In my exercises to learn javascript I wanted to avoid the more complex onRotary coding shown in the PS guide with variables and if-else needed for the first three numbers. The coding window is already very small, consequently...
Following algorithm generates, both in negative and positive, following numbers:
0 1 1 3 6 12 25 50 100 200 400 800 1600 etc.
The PS Developers guide's algorithm yields
0 1 1 3 6 13 29 67 156 372 900 2200 5443 etc.
The round numbers are just a nice to have, nothing more, a side effect when I tuned the following algorithm:
accClicks = ((clicks<0)?-1:1)*parseInt(0.390641*Math.pow(2,Math.abs(clicks))+0.4);
Replacing 0.390641 by 0.4, generates, both in negative and positive:
0 1 2 3 6 13 26 51 102 205 410 etc.
Last edited by Rusty Fobe
on January 3, 2009 17:58.