It would be great if LookAndFeel_V2::drawSpinningWaitAnimation() could have a template to use either float or int.
Currently I’ve got my own float version:
void MyCustomLookAndFeel::drawSpinningWaitAnimationFloat (Graphics& g, const Colour& colour, float x, float y, float w, float h)
{
const float radius = jmin (w, h) * 0.4f;
const float thickness = radius * 0.15f;
Path p;
p.addRoundedRectangle (radius * 0.4f, thickness * -0.5f,
radius * 0.6f, thickness,
thickness * 0.5f);
const float cx = x + w * 0.5f;
const float cy = y + h * 0.5f;
const uint32 animationIndex = (Time::getMillisecondCounter() / (1000 / 10)) % 12;
for (uint32 i = 0; i < 12; ++i)
{
const uint32 n = (i + 12 - animationIndex) % 12;
g.setColour (colour.withMultipliedAlpha ((n + 1) / 12.0f));
g.fillPath (p, AffineTransform::rotation (i * (float_Pi / 6.0f))
.translated (cx, cy));
}
}
Thanks,
Rail
