Distorting an image with DisplacementMap

The DisplacementMap effect is a pretty complex effect and takes transformations to the next level. Instead of only four corners, as in PerspectiveTransform, you can set up adjustments for each pixel of the original node. But creating a nice effect from scratch will require some math knowledge.

Let's look at the logic that adds the following wavy effect to an image we used previously in the chapter:

To shift like that, we will use the sine function and move all pixels only in vertical directions following the sine's values.

To set up DisplacementMap, you need to add coordinate correction data for each ...

Get Mastering JavaFX 10 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.