You are reading a single comment by @Owen and its replies. Click here to read the full conversation.
  • The apple-eating animation is a hollow circle that grows from the point of the apple and fades its colour out on each step.
    I added a helper function to draw the circle that was fast enough not to affect the frame rate. I don't know much C but I can try port it to be used in the Espruino graphic library.

      m.drawCircle = function(posX, posY, radX){
        var radY = 0;
        // Decision criterion divided by 2 evaluated at radX=radX, radY=0 .
        var decisionOver2 = 1 - radX;
      
        while (radX >= radY) {
          m.setPixel(radX + posX,  radY + posY);
          m.setPixel(radY + posX,  radX + posY);
          m.setPixel(-radX + posX,  radY + posY);
          m.setPixel(-radY + posX,  radX + posY);
          m.setPixel(-radX + posX, -radY + posY);
          m.setPixel(-radY + posX, -radX + posY);
          m.setPixel(radX + posX, -radY + posY);
          m.setPixel(radY + posX, -radX + posY);
          radY++;
      
          if (decisionOver2 <= 0) {
            // Change in decision criterion for radY -> radY+1 .
            decisionOver2 += 2 * radY + 1;
          }
          else {
            radX--;
            // Change for radY -> radY+1, radX -> radX-1 .
            decisionOver2 += 2 * (radY - radX) + 1;
          }
        }
      };
    
About

Avatar for Owen @Owen started