You gyus have seen those flash based flip books. I want to create the same in Java. I am using JTextArea for leaf of the book. What I want to know is how can I go about implementing the page flip effect, by overriding the componentPaint method combined with Mouse/KeyListener perhaps?
You would need to render the existing page into an off-screen buffer, then transform the buffer to render the page flip.
So,
You'd need to drive this in a thread to repeatedly invoke the re-draw whilst the animation plays out. So Set a 'pageIsTurning
' flag, and 'percentageTurned
' that will indicate to the paint method that it needs to do the special drawing and where it is in the animation. Update the percentageTurned flag as you repeatedly call the paint method, then once things are complete, reset the flag and allow the componentPaint method to default to super.componentPaint.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With