Java Reference
In-Depth Information
Glow
Makes the target appear to glow
Shadow, InnerShadow
Other classes that apply shadow effects
InvertMask
Renders a graphical inverse of the input
PerspectiveTransform
Modifies the perspective of an object to simulate 3D
SepiaTone
Renders a discoloration effect, producing an antique look
See also
F Creating your own customized Paint
F Applying cool paint effects with gradients
Creating your own Text effect
In the recipe Adding depth with lighting and shadow effects, we introduced several effect
classes that are available in JavaFX. The Text node can receive any one of these effects to
produce stunning text effects. You can, however, go beyond the available effects to produce
your own text effects by combining available Node operations and effects. In this recipe,
we are going to combine what we have learned in the second chapter's constructive area
geometry operations, and the effects covered in this chapter, to create a text cut-out effect.
Getting ready
As mentioned in the introduction, this recipe combines concepts from constructive area
geometry covered in the recipe Creating shapes with constructive area geometry from
Chapter 2 , Creating JavaFX Applications , and the Effect classes covered earlier in this
chapter to create new text effects. Hence, if you are not familiar with any of these topics,
it will be helpful to review them before continuing.
How to do it...
The next code snippet creates a text cut-out effect using ShapeSubtract to apply
constructive area geometry operation and the DropShadow class to provide depth. The full
code listing can be found in ch03/source-code/src/effects/TextEffectDemo.fx .
def w = 400; def h = 200;
def rw = w - 100; def rh = h - 50;
def bg = Rectangle {
x: w/2-rw/2 y: h/2-rh/2 width: rw height: rh
fill: LinearGradient {
startX: 0, endX: 0, startY: 0, endY: 1
Search WWH ::




Custom Search