Your code needs comments :). I like the approach of prototyping. But there is also a bit of dirty playing here, like starting from pos = 0.001. Might not be so obvious to most. The first code is too much though, no idea what it is doing I'm afraid. Furthermore, I think that the intervals function is undocumented?
Brings me to something else though, why not
Build a reference of the javascript that is implemented, so that it is easy to see what is and isn't in there; and
Provide space and speed complexity for the functions, so that you can figure out which functions you should use.
The second piece of code is nice though. I'll try to elaborate on that version.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Your code needs comments :). I like the approach of prototyping. But there is also a bit of dirty playing here, like starting from
pos = 0.001
. Might not be so obvious to most. The first code is too much though, no idea what it is doing I'm afraid. Furthermore, I think that the intervals function is undocumented?Brings me to something else though, why not
The second piece of code is nice though. I'll try to elaborate on that version.