Thinking about I'm wondering - would it be better to generate an image from the array,it would need to be a full 8bpp, could probably get away with 5 or 6.
If I can make the image roll around the screen then I can use that as the pre-calculated background?
I think having to shift or unshift the arrays is where it's slowing down so it seems like a good place generate it once and reuse it
For the effect, Each filled rectangle width is (screen width / total gradient array length) so you get the effect of each colour at the edge and the wide bar of each colour, and a pretty smooth gradient effect.
I was thinking also pre-storing all the theme steps instead of generating them each time, but if it's only run once I think having the function seems better as it's only a single calculation each time.
I also wanted a random option, but BangleJS's Math.random isn't random enough! I even tried adding a multiplier from the accelerator each time the function was called to make it more random but it was still generating colour combinations too close to each other.
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.
Thinking about I'm wondering - would it be better to generate an image from the array,it would need to be a full 8bpp, could probably get away with 5 or 6.
If I can make the image roll around the screen then I can use that as the pre-calculated background?
I think having to shift or unshift the arrays is where it's slowing down so it seems like a good place generate it once and reuse it
For the effect, Each filled rectangle width is (screen width / total gradient array length) so you get the effect of each colour at the edge and the wide bar of each colour, and a pretty smooth gradient effect.
I was thinking also pre-storing all the theme steps instead of generating them each time, but if it's only run once I think having the function seems better as it's only a single calculation each time.
I also wanted a random option, but BangleJS's Math.random isn't random enough! I even tried adding a multiplier from the accelerator each time the function was called to make it more random but it was still generating colour combinations too close to each other.