org.pushingpixels.trident.ease.Sine Java Examples

The following examples show how to use org.pushingpixels.trident.ease.Sine. 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: AbstractRadial.java    From mars-sim with GNU General Public License v3.0 6 votes vote down vote up
public AbstractRadial() {
      super();
      lcdTimeline = new Timeline(this);
      lcdValue = 0;
      lcdUnitString = getUnitString();
      ledPosition = new Point2D.Double(0.6, 0.4);
      userLedPosition = new Point2D.Double(0.3, 0.4);
      INNER_BOUNDS = new Rectangle(200, 200);
      GAUGE_BOUNDS = new Rectangle(200, 200);
      FRAMELESS_BOUNDS = new Rectangle(200, 200);
      FRAMELESS_OFFSET = new Point2D.Double(0, 0);
      transparentSectionsEnabled = false;
      transparentAreasEnabled = false;
      expandedSectionsEnabled = false;
      tickmarkDirection = Direction.CLOCKWISE;
      timeline = new Timeline(this);
      STANDARD_EASING = new Spline(0.5f);
      RETURN_TO_ZERO_EASING = new Sine();
horizontalAlignment = SwingConstants.CENTER;
verticalAlignment = SwingConstants.CENTER;
      lcdTextVisible = true;
      LCD_BLINKING_TIMER = new Timer(500, this);
      addComponentListener(this);
  }
 
Example #2
Source File: AbstractLinear.java    From mars-sim with GNU General Public License v3.0 6 votes vote down vote up
public AbstractLinear() {
    super();
    INNER_BOUNDS = new Rectangle(120, 300);
    startingFromZero = false;
    transparentSectionsEnabled = false;
    transparentAreasEnabled = false;
    ledPosition = new Point2D.Double((getInnerBounds().width - 18.0 - 16.0) / getInnerBounds().width, 0.453271028);
    userLedPosition = new Point2D.Double(18.0 / getInnerBounds().width, 0.453271028);
    lcdValue = 0;
    lcdTimeline = new Timeline(this);
    lcdUnitString = getUnitString();
    lcdInfoString = "";
    timeline = new Timeline(this);
    STANDARD_EASING = new Spline(0.5f);
    RETURN_TO_ZERO_EASING = new Sine();
    lcdTextVisible = true;
    LCD_BLINKING_TIMER = new Timer(500, this);
    addComponentListener(this);
}
 
Example #3
Source File: JAnimatedLogo.java    From otroslogviewer with Apache License 2.0 5 votes vote down vote up
private void createTimeLine() {
  LogoIcon icon = new LogoIcon();
  this.setIcon(icon);

  timeLine = new SwingRepaintTimeline(this);
  timeLine.addPropertyToInterpolate("alpha", 0, 45);
  timeLine.setDuration(800);
  timeLine.setEase(new Sine());
}
 
Example #4
Source File: JLabelStatusObserver.java    From otroslogviewer with Apache License 2.0 5 votes vote down vote up
@Override
public void updateStatus(String text, int level) {
  label.setText(text);
  if (level == LEVEL_NORMAL) {
    label.setBackground(colorNormal);
  } else {
    Color blinkColor = (level == LEVEL_WARNING) ? colorWarning : colorError;
    Timeline timeline = new Timeline(label);
    timeline.setDuration(200);
    timeline.setEase(new Sine());
    timeline.addPropertyToInterpolate("background", colorNormal, blinkColor);
    timeline.playLoop(8, RepeatBehavior.REVERSE);
  }
}
 
Example #5
Source File: MemoryUsedStatsUpdater.java    From otroslogviewer with Apache License 2.0 5 votes vote down vote up
@Override
public void run() {
  while (true) {
    long heapMaxSize = Runtime.getRuntime().maxMemory();
    long heapSize = Runtime.getRuntime().totalMemory();
    long free = Runtime.getRuntime().freeMemory();
    final float percentUsed = 100 * ((heapSize - free) / (float) heapSize);
    long percentOfTotalUsed = 100 * (heapSize - free) / heapMaxSize;
    Color newColor = Color.GREEN;
    if (percentOfTotalUsed > 93) {
      newColor = Color.RED;
    } else if (percentOfTotalUsed > 83) {
      newColor = Color.ORANGE;
    } else if (percentOfTotalUsed > 75) {
      newColor = Color.YELLOW;
    }
    final String message = String.format("Used %sMB of %sMB", nf.format((percentUsed * heapSize / (100 * 1024 * 1024))), nf.format(heapSize / (1024 * 1024)));
    final String toolTip = message
      + String.format(". Total available for VM %sMB. Double click to invoke System.gc()", nf.format(heapMaxSize / (1024 * 1024)));
    Timeline timeline = new Timeline(bar);
    timeline.addPropertyToInterpolate("value", bar.getValue(), (int) percentUsed);
    timeline.addPropertyToInterpolate("foreground", bar.getForeground(), newColor);
    timeline.setEase(new Sine());
    timeline.setDuration(1200);
    timeline.play();
    SwingUtilities.invokeLater(() -> {
      bar.setString(message);
      bar.setToolTipText(toolTip);
    });

    try {
      Thread.sleep(refreshTime);
    } catch (InterruptedException ignore) {
    }
  }
}
 
Example #6
Source File: MyWindowUtil.java    From gameserver with Apache License 2.0 5 votes vote down vote up
/**
 * Create an animation JComponent.
 * @param comp
 * @param to
 * @return
 */
public static Timeline createLocationTimeline(Component comp, Point to, int duration) {
	Timeline timeline = new Timeline(LoginDialog.getInstance());
	to.y = MainFrame.screenHeight;
	timeline.addPropertyToInterpolate("location", comp.getLocation(), to);
	timeline.setDuration(duration);
	timeline.setEase(new Sine());
	return timeline;
}