org.pushingpixels.trident.Timeline.TimelineState Java Examples

The following examples show how to use org.pushingpixels.trident.Timeline.TimelineState. 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: MyWindowUtil.java    From gameserver with Apache License 2.0 6 votes vote down vote up
/**
   * @param window
   * @param fadeOutDuration
   */
  private static void fadeOutAndEnd(final Window window, int fadeOutDuration, 
          final boolean exit) {
      Timeline dispose = new Timeline(new WindowFader(window));
      dispose.addPropertyToInterpolate("opacity", 1.0f,
//              AWTUtilitiesWrapper.getWindowOpacity(window), 
              0.0f);
      dispose.addCallback(new UIThreadTimelineCallbackAdapter() {
          @Override
          public void onTimelineStateChanged(TimelineState oldState,
                  TimelineState newState, float durationFraction,
                  float timelinePosition) {
              if (newState == TimelineState.DONE) {
                  if (exit) {
                      Runtime.getRuntime().exit(0);
                  } else {
                      window.dispose();
                  }
              }
          }
      });
      dispose.setDuration(fadeOutDuration);
      dispose.play();
  }
 
Example #2
Source File: AudioCallback.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
/**
 * @see TimelineCallback#onTimelineStateChanged(TimelineState,
 *      TimelineState, float, float)
 */
@Override
public void onTimelineStateChanged(final TimelineState oldState,
		final TimelineState newState, final float durationFraction,
		final float timelinePosition) {
	if (newState == Timeline.TimelineState.DONE)
		nextTimeline.play();
}
 
Example #3
Source File: LoginService.java    From gameserver with Apache License 2.0 5 votes vote down vote up
@Override
protected void done() {
	final LoginDialog dialog = LoginDialog.getInstance();
	if ( !loginResult ) {
		dialog.getResultLabel().setText("登陆失败");
		dialog.getOKButton().setEnabled(true);
		dialog.getOKButton().setText("确定");
	} else {
		ConfigManager.saveConfigKeyValue(ConfigKey.adminUsername, username);
		ConfigManager.saveConfigKeyValue(ConfigKey.adminPassword, password);
		ConfigManager.saveConfigKeyValue(ConfigKey.adminDatabaseServer, mongoServer);
		
		Point to = dialog.getLocation();
		to.y = MainFrame.screenHeight;
		Timeline timeline = MyWindowUtil.createLocationTimeline(dialog, to, 200);
		timeline.addCallback(new TimelineCallbackAdapter() {

			/* (non-Javadoc)
			 * @see org.pushingpixels.trident.callback.TimelineCallbackAdapter#onTimelineStateChanged(org.pushingpixels.trident.Timeline.TimelineState, org.pushingpixels.trident.Timeline.TimelineState, float, float)
			 */
			@Override
			public void onTimelineStateChanged(TimelineState oldState,
					TimelineState newState, float durationFraction,
					float timelinePosition) {
				if ( newState == TimelineState.DONE ) {
					dialog.dispose();
				}
			}
			
		});
		timeline.play();
	}
}
 
Example #4
Source File: CardAnimation.java    From magarena with GNU General Public License v3.0 5 votes vote down vote up
private Timeline getShrinkTimeline() {
    final Timeline timeline = new Timeline(this);
    timeline.addPropertyToInterpolate("ShrinkRectangle", getPreviewRectangle(), getEnd());
    timeline.setDuration(SHRINK_DURATION);
    timeline.setEase(new Spline(0.8f));
    timeline.addCallback(new TimelineCallbackAdapter() {
        @Override
        public void onTimelineStateChanged(Timeline.TimelineState oldState, Timeline.TimelineState newState, float durationFraction, float timelinePosition) {
            if (newState == Timeline.TimelineState.DONE) {
                scenario.cancel();
            }
        }
    });
    return timeline;
}
 
Example #5
Source File: CardAnimation.java    From magarena with GNU General Public License v3.0 5 votes vote down vote up
private Timeline getViewTimeline() {
    final Timeline timeline = new Timeline();
    timeline.setDuration(getViewDuration());
    timeline.addCallback(new TimelineCallbackAdapter() {
        @Override
        public void onTimelineStateChanged(Timeline.TimelineState oldState, Timeline.TimelineState newState, float durationFraction, float timelinePosition) {
            if (newState == Timeline.TimelineState.PLAYING_FORWARD) {
                // ensures arrow is painted correctly.
                getCanvas().repaint();
            }
        }
    });
    return timeline;
}
 
Example #6
Source File: CardAnimation.java    From magarena with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void doCancelAction() {
    if (viewTimeline.getState() == Timeline.TimelineState.PLAYING_FORWARD) {
        viewTimeline.cancel();
        shrinkTimeline.play();
    }
}
 
Example #7
Source File: CardAnimation.java    From magarena with GNU General Public License v3.0 4 votes vote down vote up
private boolean isRunning(Timeline t) {
    return t != null && (t.getState() == TimelineState.READY || t.getState() == TimelineState.PLAYING_FORWARD);
}
 
Example #8
Source File: AnimationPanel.java    From magarena with GNU General Public License v3.0 4 votes vote down vote up
private void stopPulsingBorderAnimation() {
    if (pulseBorderTimeline != null && pulseBorderTimeline.getState() != TimelineState.IDLE) {
        pulseBorderTimeline.abort();
        setPulsingBorderOpacity(0);
    }
}