When instantiating timelines, this is usually done with a series of key frames. However, the creation of each key frame requires the instantiation of both a KeyFrame, a Duration, and a KeyValue object, like this
new Timeline(
new KeyFrame(new Duration(100), new KeyValue(sendingLabel.opacityProperty(), 1.0)),
new KeyFrame(new Duration(800), new KeyValue(sendingLabel.opacityProperty(), 0.0))
);
I recommend this is simplified by introducing 1 additional constructor in KeyFrame, which will allow me to write the code above as follows:
new Timeline(
new KeyFrame(100, sendingLabel.opacityProperty(), 1.0),
new KeyFrame(800, sendingLabel.opacityProperty(), 0.0)
);
I hope it is evident to the reader, that this involves much less typing and is easier to learn, easier to read, and less expensive to maintain.
new Timeline(
new KeyFrame(new Duration(100), new KeyValue(sendingLabel.opacityProperty(), 1.0)),
new KeyFrame(new Duration(800), new KeyValue(sendingLabel.opacityProperty(), 0.0))
);
I recommend this is simplified by introducing 1 additional constructor in KeyFrame, which will allow me to write the code above as follows:
new Timeline(
new KeyFrame(100, sendingLabel.opacityProperty(), 1.0),
new KeyFrame(800, sendingLabel.opacityProperty(), 0.0)
);
I hope it is evident to the reader, that this involves much less typing and is easier to learn, easier to read, and less expensive to maintain.