Provide a simplified convenience KeyFrame constructor

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Unresolved
    • Priority: P4
    • tbd
    • Affects Version/s: None
    • Component/s: javafx
    • None

      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.

            Assignee:
            Nir Lisker
            Reporter:
            Randahl Isaksen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: