org.pushingpixels.trident.callback.TimelineCallback Java Examples

The following examples show how to use org.pushingpixels.trident.callback.TimelineCallback. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CardFlowTimeline.java    From magarena with GNU General Public License v3.0 6 votes vote down vote up
/**
     * Sets custom pulse behavior - higher frame rate, lower frame rate or dynamic frame rate.
     * <p>
     * By default, Trident timelines are driven by a dedicated thread that wakes up every 40ms and
     * updates all the timelines. When the CPU is not heavily used this results in 25 frames-per-second
     * refresh rate for Trident-driven UI animations - consistent with the frame rate of theatrical films
     * and non-interlaced PAL television standard.
     * <p>
     * (see https://kenai.com/projects/trident/pages/CustomPulseSource)
     *
     * Must be run before any instance of Timeline is created in the application otherwise it will
     * generate the "cannot replace the pulse source thread once it's running..." error.
     */
//    static {
//        try {
//            TridentConfig.getInstance().setPulseSource(() -> {
//                try {
//                    Thread.sleep(30);
//                } catch (InterruptedException ex) {
//                    LOGGER.log(Level.WARNING, null, ex);
//                }
//            });
//        } catch (RuntimeException ex) {
//            LOGGER.log(Level.WARNING, ex.getMessage());
//        }
//    }

    CardFlowTimeline(TimelineCallback aCallback, long durationMs) {
        setDuration(durationMs);
        setEase(new Spline(0.8f));
        addCallback(aCallback);
    }
 
Example #2
Source File: MercuryTracker.java    From MercuryTrade with MIT License 4 votes vote down vote up
public void addTimelineCallback(TimelineCallback callback) {
    this.progressTl.addCallback(callback);
}