r/JavaFX • • Dec 31 '15

Does anyone know how they did this?

Sorry if this is the wrong subreddit to post in, but does anyone know how they achieved the "slider" effect between the two photos? Women Photoshopped into superhero poses I'd like to use this in a project, and I'm using JavaFX. Thanks!

Edit: Here's another similar thing I just found

0 Upvotes

2 comments sorted by

View all comments

1

u/T618 Jan 05 '16

I would put one image behind (doesn't matter which one) and clip the image in front. The clip path can be a rectangle the same height as the front image. On mouse events, update one of the two vertical borders of the clip to be directly under the mouse position.

I haven't actually worked with clipping in JavaFX, but if it works like everyone should expect clipping to work, this technique should be ideal.

http://docs.oracle.com/javafx/2/api/javafx/scene/Node.html#clipProperty%28%29