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

CAG operations (ShapeSubtract, ShapeIntersect) doesn't respect binding, eg. in animations

    XMLWordPrintable

Details

    Description

      CAG operations, like ShapeSubtract and ShapeIntersect, doesn't respect binding: they seem to be done at creation time and doesn't change afterward.
      Simple demonstration:

      var circle1 = Circle
      {
        centerX: 100
        centerY: 100
        radius: 50
      }
      var ellipse1 = Ellipse
      {
        centerX: 100
        centerY: 130
        radiusX: 30
        radiusY: bind tradius + 10
      }

      var circle2 = Circle
      {
        centerX: 200
        centerY: 100
        radius: 50
      }
      var ellipse2 = Ellipse
      {
        centerX: 200
        centerY: 130
        radiusX: 30
        radiusY: bind tradius + 10
      }
      var ellipse3 = Ellipse
      {
        centerX: 300
        centerY: 130
        radiusX: 30
        radiusY: bind tradius + 10
        fill: Color.LIGHTBLUE
      }

      // ShapeSubstract doesn't follow binding
      var shapeS = ShapeSubtract
      {
        a: circle1
        b: ellipse1
        fill: Color.LIGHTGREEN
      }
      var shapeI = ShapeIntersect
      {
        a: circle2
        b: ellipse2
        fill: Color.LIGHTGREEN
      }

      def BASE_SIZE = 300;
      def MARGIN = BASE_SIZE / 30;
      def RADIUS = BASE_SIZE / 2 - MARGIN * 4;
      var a = 0;
      Stage
      {
        title: "ShapeXxx Test"
        visible: true
        scene: Scene
        {
          width: BASE_SIZE * 1.618
          height: BASE_SIZE
          fill: Color.web('#00BABE')
          content:
          [
            shapeS,
            shapeI,
            ellipse3
          ]
        }
      }

      var tradius;
      var animation = Timeline
      {
        keyFrames:
        [
          KeyFrame
          {
            time: 0s
            values: tradius => 10
          }
          KeyFrame
          {
            time: 10s
            values: tradius => 100
          }
        ]
      };
      animation.play();

      Attachments

        Issue Links

          Activity

            People

              kcr Kevin Rushforth
              plhostejfx Philippe Lhoste (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported: