【发布时间】:2014-08-22 12:18:43
【问题描述】:
我有大量节点,目前正在使用下面的淡入淡出过渡代码,
ft1 = new FadeTransition(Duration.millis(500), hBox_outter_last);
ft1.setFromValue(1.0);
ft1.setToValue(0.3);
ft1.setCycleCount(Animation.INDEFINITE);
ft1.setAutoReverse(true);
ft1.play();
但是这很消耗 CPU,并且被告知我可以使用以下内容,但这不起作用,任何人都可以帮助解决这个问题
DoubleProperty opacity = new SimpleDoubleProperty();
Transition opacityTransition = new Transition() {
protected void interpolate(double frac) {
opacity.set(frac);
}
};
// elsewhere
hBox_outter_last.opacityProperty().bind(opacity);
【问题讨论】: