Hello;

Is there a way in java to create a flip card effect. I have two pictures, that are to form a double sided card. Ive come with a way to snapshot them in different angles and finally iterate through them in a loop. Its not very good :) Is there another way?

Basically I need to merge these two pictures together and when a user clicks on them the card flips and displays its back side.

Some examples or links maybe where I could get some further info?

Thank you very much

Joey

Recommended Answers

All 3 Replies

Member Avatar for hfx642

Sounds like you've got the method right...
You just have to refine the implementation.
Good luck!

I'd be very interested to hear how you did the "snapshot", but yes, there's no way around displaying the incremental stages of the "flipping" graphics in a loop. (But not a loop as such - that's going to mess up Swing's event thread - use a javax.swing.Timer to control the update/repaints).

If you don't need to compute the views on the fly you could maybe use an animated GIF created in Photoshop or whatever to simplify your Java code.

My idea: make a jPanel for each card, and use an Affine Transform object to:

- Reduce the width of the panel to 0
- Paint the other image
- Enlarge the width of the panel to the previous width

Like James said, you'll need to some some timing.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.