本文整理汇总了Java中org.pushingpixels.trident.Timeline.play方法的典型用法代码示例。如果您正苦于以下问题:Java Timeline.play方法的具体用法?Java Timeline.play怎么用?Java Timeline.play使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pushingpixels.trident.Timeline
的用法示例。
在下文中一共展示了Timeline.play方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fadeOutAndEnd
import org.pushingpixels.trident.Timeline; //导入方法依赖的package包/类
/**
* @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();
}
示例2: fadeOutAndEnd
import org.pushingpixels.trident.Timeline; //导入方法依赖的package包/类
/**
* @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();
}
示例3: showPopup
import org.pushingpixels.trident.Timeline; //导入方法依赖的package包/类
private void showPopup() {
if (MagicAnimations.isOn(AnimationFx.CARD_FADEIN)) {
if (opacity == 0f) {
fadeInTimeline = new Timeline();
fadeInTimeline.setDuration(200);
fadeInTimeline.setEase(new Spline(0.8f));
fadeInTimeline.addPropertyToInterpolate(
Timeline.property("opacity")
.on(this)
.from(0.0f)
.to(1.0f));
fadeInTimeline.play();
} else {
opacity = 1.0f;
}
} else {
opacity = 1.0f;
}
setVisible(true);
}
示例4: setVisible
import org.pushingpixels.trident.Timeline; //导入方法依赖的package包/类
@Override
public void setVisible(boolean aFlag) {
super.setVisible(aFlag);
if (ImageHelper.isWindowTranslucencySupported()) {
if (aFlag == false) {
setOpacity(0f);
} else {
fadeInTimeline = new Timeline();
fadeInTimeline.setDuration(200);
fadeInTimeline.setEase(new Spline(0.8f));
fadeInTimeline.addPropertyToInterpolate(
Timeline.property("opacity")
.on(this)
.from(0.0f)
.to(1.0f));
fadeInTimeline.play();
}
}
}
示例5: run
import org.pushingpixels.trident.Timeline; //导入方法依赖的package包/类
@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: done
import org.pushingpixels.trident.Timeline; //导入方法依赖的package包/类
@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();
}
}
示例7: animateToWidth
import org.pushingpixels.trident.Timeline; //导入方法依赖的package包/类
public synchronized void animateToWidth(int width){
if( isVisible() ){
//setWidth(width);
Timeline t = new Timeline(this);
t.addPropertyToInterpolate("width", getWidth(), width);
t.setDuration(100);
t.play();
}
}
示例8: fadeIn
import org.pushingpixels.trident.Timeline; //导入方法依赖的package包/类
private void fadeIn(){
if( !JHollaManager.getInstance().isTranslucencySupported() )
return;
if( fadeOutTimeLine != null && !fadeOutTimeLine.isDone() )
fadeOutTimeLine.cancel();
fadeInTimeLine = new Timeline(this);
fadeInTimeLine.addPropertyToInterpolate("opacity", getOpacity(), 1.0f);
fadeInTimeLine.setDuration(500);
fadeInTimeLine.play();
}
示例9: fadeOut
import org.pushingpixels.trident.Timeline; //导入方法依赖的package包/类
private void fadeOut(){
if( !JHollaManager.getInstance().isTranslucencySupported() )
return;
if( fadeInTimeLine != null && !fadeInTimeLine.isDone() )
fadeInTimeLine.cancel();
fadeOutTimeLine = new Timeline(this);
fadeOutTimeLine.addPropertyToInterpolate("opacity", getOpacity(), DEFAULT_OPACITY);
fadeInTimeLine.setDuration(1500);
fadeOutTimeLine.play();
}
示例10: doDropAnimation
import org.pushingpixels.trident.Timeline; //导入方法依赖的package包/类
private void doDropAnimation() {
dropTimeline = new Timeline(this);
dropTimeline.addCallback(this);
dropTimeline.addPropertyToInterpolate("ImageScale", 6f, 1f);
dropTimeline.setDuration(500);
dropTimeline.play();
}
示例11: doHealAnimation
import org.pushingpixels.trident.Timeline; //导入方法依赖的package包/类
private void doHealAnimation() {
if (GeneralConfig.get(BooleanSetting.ANIMATE_GAMEPLAY)) {
final Timeline timeline = new Timeline();
timeline.setDuration(1000);
timeline.setEase(new Spline(0.8f));
timeline.addPropertyToInterpolate(
Timeline.property("healColorOpacity").on(this).from(100).to(0));
timeline.play();
}
}
示例12: nextCall
import org.pushingpixels.trident.Timeline; //导入方法依赖的package包/类
private void nextCall(){
if( isBusy || queue.isEmpty() )
return;
synchronized( notifs ){
if( notifs.size() >= CAPACITY )
return;
}
isBusy = true;
final JHolla n = queue.poll();
if( !n.hasBeenBuilt() )
n.build();
//n.setLocation(new Point(screenDimension.width - n.getPreferredSize().width - 10, screenDimension.height));
if( alignment == Alignment.LEFT )
n.setLocation(new Point(insetsLeft + 20, screenDimension.height));
else
n.setLocation(new Point(screenDimension.width - n.getPreferredSize().width - insetsRight - 20, screenDimension.height));
n.setVisible(true);
SwingUtilities.invokeLater(new Runnable(){
public void run(){
n.pack();
n.revalidate();
n.repaint();
((BorderLayout) n.getContentPane().getLayout()).invalidateLayout(n.getContentPane());
n.pack();
}
});
Timeline t = new Timeline(n);
t.setDuration(500);
t.addPropertyToInterpolate("location", n.getLocation(), new Point(n.getLocation().x, screenDimension.height - n.getHeight() - 10));
t.addCallback(new TimelineCallbackAdapter() {
@Override
public void onTimelineStateChanged(TimelineState state1, TimelineState state2,
float arg2, float arg3) {
if( state2 == TimelineState.DONE ){
n.setAsFullyVisible();
notifs.add(n);
executor.execute(n);//start timeout thread
repaint();
isBusy = false;
SwingUtilities.invokeLater(new Runnable(){
public void run(){
nextCall();
}
});
}
}
});
t.play();
}
示例13: removeNotification
import org.pushingpixels.trident.Timeline; //导入方法依赖的package包/类
public void removeNotification(final JHolla n){
synchronized( queue ){
if( queue.contains(n) ){
queue.remove();
return;
}
}
synchronized( queue ){
if( !notifs.contains(n) )
return;
}
Timeline t = new Timeline(n);
t.setDuration(500);
//t.addPropertyToInterpolate("opacity", n.getOpacity(), 0.0f);
t.addPropertyToInterpolate("location", n.getLocation(), new Point(n.getLocation().x, screenDimension.height));
t.addCallback(new TimelineCallbackAdapter() {
@Override
public void onTimelineStateChanged(TimelineState state1, TimelineState state2,
float arg2, float arg3) {
if( state2 == TimelineState.DONE ){
JHolla.JHollaListener[] listeners = n.getListeners();
n.setVisible(false);
n.dispose();
notifs.remove(n);
for( int i = 0 ; i < listeners.length; i++ )
listeners[i].removed();
repaint();
SwingUtilities.invokeLater(new Runnable(){
public void run(){
nextCall();
}
});
}
}
});
t.play();
}