Javafx 是否有更多的票务设置我可以调整?
在标签上打勾时,有没有简单的方法可以做到以下几点Javafx 是否有更多的票务设置我可以调整?,javafx,codenameone,ticker,Javafx,Codenameone,Ticker,在标签上打勾时,有没有简单的方法可以做到以下几点 每次文本返回其原始位置时暂停3秒 缓进缓出滴答声之间的间隔。类似于JavaFX运动,用于放松进出 让滴答声更顺畅,而不是有点紧张 是的,但您需要手动执行 只需覆盖Label并覆盖其animate()方法。我没有尝试过这种方法,但类似的方法可以满足您的所有要求: Label tickeredLabel = new Label(myText) { Motion tickeringMotion; long pauseTime = Sys
是的,但您需要手动执行 只需覆盖
Label
并覆盖其animate()
方法。我没有尝试过这种方法,但类似的方法可以满足您的所有要求:
Label tickeredLabel = new Label(myText) {
Motion tickeringMotion;
long pauseTime = System.currentTimeMillis();
public boolean animate() {
long currentTime = System.currentTimeMillis();
// wait 3 seconds for tickering
if(currentTime - pauseTime < 3000) {
return false;
}
// use ease in/out motion over 5 seconds
if(tickeringMotion == null) {
tickeringMotion = Motion.createEaseInOutMotion(0, getStringWidth(getStyle().getFont(), 5000);
tickeringMotion.start();
} else {
// when motion is finished return to 3 second delay
if(tickeringMotion.isFinished()) {
tickeringMotion = null;
pauseTime = System.currentTimeMillis();
}
}
setShiftText(tickeringMotion.getValue());
return changed;
}
};
Label tickeredLabel=新标签(myText){
运动票;
长暂停时间=System.currentTimeMillis();
公共布尔动画(){
长currentTime=System.currentTimeMillis();
//等待3秒钟,等待提示
if(当前时间-暂停时间<3000){
返回false;
}
//在5秒钟内使用缓进/缓出动作
if(tickeringMotion==null){
tickeringMotion=Motion.CreateAseInOutMotion(0,getStringWidth(getStyle().getFont(),5000);
tickeringMotion.start();
}否则{
//运动完成后,返回3秒延迟
if(tickeringMotion.isFinished()){
tickeringMotion=null;
pauseTime=System.currentTimeMillis();
}
}
setShift文本(tickeringMotion.getValue());
回报发生变化;
}
};
为了进一步消除滴答声,只需让滴答声一次移动一个像素,特别是对于未来的情况,我建议您将此类问题分为3个问题,因为如果开发人员不知道其中一个问题的答案,他可能不会在他知道的问题上发布答案。