Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8169591

Make totalLength of Path in PathTransition accessible to allow length-dependent durations

XMLWordPrintable

      A DESCRIPTION OF THE REQUEST :
      The field totalLength of PathTransition should be made accessible (for example by providing a getter). Using this information, an API user can adjust the duration or rate of the animation to take the length of the animation path into account.

      JUSTIFICATION :
      Currently, the "speed" of the PathTransition animation with a linear interpolator can be adjusted by setting the duration and rate. However, for some use cases, having several animations play with the same "speed" is required: For example, two circles should travel along two paths of different length, but with the same movement speed. This can currently not be specified without knowing the lengths of the paths to adjust the duration or rate accordingly: To get the same speed, the animation for a path of length 2L should have a rate of 0.5 compared to an animation with a path of length L. The PathTransition already computes and holds this information internally (field totalLength) and could easily provide access to it by adding a getter or property.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The PathTransition should provide access to the path length information (field totalLength) by adding a getter or property.
      ACTUAL -
      There is no way to simply access the totalLength information of PathTransition: It is a private field and the methods to compute the value are private as well.

      CUSTOMER SUBMITTED WORKAROUND :
      The full source code of PathTransition could be copied into a custom PathTransition class, with an added access method for totalLength. This works, but goes against conventions like not duplicating code.

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: