final TabSection nextSection = this.tabs.get(now.intValue());
Label prevLabel = prevSection.label;
Label nextLabel = nextSection.label;
// It'd be nice to find a way of eliminating this duplication with the CSS file, but during initialisation
// it seems styles were not applied yet. And JFX doesn't support CSS animations yet.
Color inactiveColor = Color.web("#ff8888");
Color activeColor = Color.RED;
// Don't animate the tab transition the first time we appear.
if (before.intValue() != -1) {
final Animation colorAnim = new Transition() {
{
setCycleDuration(millis(400));
}
@Override
protected void interpolate(double v) {
Color color = inactiveColor.interpolate(activeColor, v);
nextLabel.setBackground(new Background(new BackgroundFill(color, null, null)));
}
};
colorAnim.play();