Nice! For the disc, you could try something like:
let yOffset = -Radius; setTimeout(function cb() { for (let xOffset = -Radius; xOffset <= Radius; xOffset++) { let OffsetSquared = xOffset*xOffset + yOffset*yOffset; if (OffsetSquared <= RadiusSquared) { let Hue = Rad2Deg(Math.atan2(yOffset,xOffset)); let Saturation = Math.sqrt(OffsetSquared)/Radius; let RGB = HSVtoRGB(Hue, Saturation, Value); let Color = RGB[0] << 11 | RGB[1] << 5 | RGB[2]; g.setPixel(Radius+xOffset,Radius+yOffset, Color); } } yOffset++; if (yOffset <= Radius) setTimeout(cb,10); },10);
To ensure that it doesn't 'hang' the browser while computing it :)
@Gordon started
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.
Nice! For the disc, you could try something like:
To ensure that it doesn't 'hang' the browser while computing it :)