【发布时间】:2016-09-19 11:00:29
【问题描述】:
您好,我想做这样的事情:
我有文字,我希望文字一直从右向左移动。我想为移动文本设置边界是窗格边界。现在我有了这个,但它并没有按照我想要的方式工作
public static void start(Text msg) {
msg.setTextOrigin(VPos.TOP);
double sceneWidth = Config.xSize;
double msgWidth = msg.getLayoutBounds().getWidth();
KeyValue initKeyValue = new KeyValue(msg.translateXProperty(), sceneWidth);
KeyFrame initFrame = new KeyFrame(Duration.ZERO, initKeyValue);
KeyValue endKeyValue = new KeyValue(msg.translateXProperty(), -1.0
* msgWidth);
KeyFrame endFrame = new KeyFrame(Duration.seconds(50), endKeyValue);
Timeline timeline = new Timeline(initFrame, endFrame);
timeline.setCycleCount(Timeline.INDEFINITE);
timeline.play();
我想在我的应用程序中有一个从右到左的幻灯片文本
【问题讨论】:
-
你的意思是它没有按照你想要的方式工作?是不是只有一次动画?还是什么都没发生?或者它正在颠倒?怎么了?我们提供帮助的能力仅限于您帮助我们了解问题的程度。
-
@iMan 我编辑我的帖子