canvas.setHeight(size);
ctx.clearRect(0, 0, size, size);
if (isFrameVisible()) { //frame
Paint frame = new LinearGradient(0.14 * size, 0.14 * size,
0.84 * size, 0.84 * size,
false, CycleMethod.NO_CYCLE,
new Stop(0.0, Color.rgb(20, 20, 20, 0.65)),
new Stop(0.15, Color.rgb(20, 20, 20, 0.65)),
new Stop(0.26, Color.rgb(41, 41, 41, 0.65)),
new Stop(0.26, Color.rgb(41, 41, 41, 0.64)),
new Stop(0.85, Color.rgb(200, 200, 200, 0.41)),
new Stop(1.0, Color.rgb(200, 200, 200, 0.35)));
ctx.setFill(frame);
ctx.fillOval(0, 0, size, size);
}
InnerShadow innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 0.07 * size, 0, 0, 0);
if (isOn()) { //on
ctx.save();
Paint on = new LinearGradient(0.25 * size, 0.25 * size,
0.74 * size, 0.74 * size,
false, CycleMethod.NO_CYCLE,
new Stop(0.0, ((Color)ledColor.get()).deriveColor(0d, 1d, 0.77, 1d)),
new Stop(0.49, ((Color)ledColor.get()).deriveColor(0d, 1d, 0.5, 1d)),
new Stop(1.0, ((Color)ledColor.get())));
innerShadow.setInput(new DropShadow(BlurType.TWO_PASS_BOX, (Color)ledColor.get(), 0.36 * size, 0, 0, 0));
ctx.setEffect(innerShadow);
ctx.setFill(on);
ctx.fillOval(0.14 * size, 0.14 * size, 0.72 * size, 0.72 * size);
ctx.restore();
} else { // off
ctx.save();
Paint off = new LinearGradient(0.25 * size, 0.25 * size,
0.74 * size, 0.74 * size,
false, CycleMethod.NO_CYCLE,
new Stop(0.0, ((Color)ledColor.get()).deriveColor(0d, 1d, 0.20, 1d)),
new Stop(0.49, ((Color)ledColor.get()).deriveColor(0d, 1d, 0.13, 1d)),
new Stop(1.0, ((Color)ledColor.get()).deriveColor(0d, 1d, 0.2, 1d)));