Sometimes using an Image will limit you in adding an effect on it, especially if you’re working on animations or a game application. So to give an example I tried creating a playing card suit shapes using the Path class and the Path elements.
Here is the code snippet of the Spade I made:
Path spade = new Path(); spade.getElements().add(new MoveTo(25.0f, 0.0f)); spade.getElements().add(new LineTo(45.0f, 30.0f)); spade.getElements().add(QuadCurveToBuilder.create() .controlX(40.0f) .controlY(50.0f) .x(27.0f) .y(30.0f) .build()); spade.getElements().add(QuadCurveToBuilder.create() .controlX(28.0f) .controlY(35.0f) .x(35.0f) .y(50.0f) .build()); spade.getElements().add(new LineTo(15.0f, 50.0f)); spade.getElements().add(QuadCurveToBuilder.create() .controlX(22.0f) .controlY(35.0f) .x(23.0f) .y(30.0f) .build()); spade.getElements().add(QuadCurveToBuilder.create() .controlX(10.0f) .controlY(50.0f) .x(5.0f) .y(30.0f).build()); spade.getElements().add(new LineTo(25.0f, 0.0f));
Anatoliy said:
Hello!
Cool effects!
What’s a pity, app is too resource hungry.
20% of i5-2500 and seriously loads GPU ( that is good, it means GPU do CPU’s work )
But for now, I hope, you’ll agree, resource consumption doesn’t match complexity…
Pingback: JavaFX links of the week, February 21 // JavaFX News, Demos and Insight // FX Experience
Pingback: Java desktop links of the week, February 21 – Jonathan Giles