Java源码示例:org.pushingpixels.trident.ease.Sine
示例1
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);
}
示例2
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);
}
示例3
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());
}
示例4
@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);
}
}
示例5
@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) {
}
}
}
示例6
/**
* 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;
}