我目前正在开发一款java游戏,它由javafx ui支持。
玩家。应该能够与全国人民代表大会对话,这是没有问题的。但是我想要一个特定的文本效果。就像在polemon游戏或undertale中,文本逐个字母缓慢地出现。
我如何才能做到这一点呢?
发布于 2017-02-19 22:26:20
Label label = /* the label */ ;
String text = /* text to display */;
IntegerProperty lettersDisplayed = new SimpleIntegerProperty();
label.textProperty().bind(Bindings.createStringProperty(
() -> text.substring(0, lettersDisplayed.get()),
lettersDisplayed);
Timeline textAnimation = new Timeline(
new KeyFrame(Duration.seconds(2), new KeyValue(lettersDisplayed, text.length()))
);https://stackoverflow.com/questions/42327542
复制相似问题