我想用"宽度"制作动画。我的节点
在这种情况下,我的节点是" AnchorPane"。
我尝试在javafx中制作导航抽屉。
没有属性" width属性()"?
new Key Value (node.width Property (), 1, WEB_EASE)
node.widthProperty().getValue(
)未找到
我的代码:
public void changeWidth(final Node node, double width) {
this.node = node;
this.timeline = TimelineBuilder.create()
.keyFrames(
new KeyFrame(Duration.millis(20),
new KeyValue( going here? , width, WEB_EASE)
)
)
.build();
setCycleDuration(Duration.seconds(5));
setDelay(Duration.seconds(0));
}
示例"不透明度"属性:
new KeyValue(node.opacityProperty(), 1, WEB_EASE)
我的班级ConfigAnimationViewPane:
public class ConfigAnimationViewPane extends Transition {
protected static final Interpolator WEB_EASE = Interpolator.EASE_BOTH;
protected AnchorPane node;
protected Timeline timeline;
private boolean oldCache = false;
private CacheHint oldCacheHint = CacheHint.DEFAULT;
private final boolean useCache = true;
/**
* Called when the animation is starting
*/
protected void starting() {
if (useCache) {
oldCache = node.isCache();
oldCacheHint = node.getCacheHint();
node.setCache(true);
node.setCacheHint(CacheHint.SPEED);
}
}
/**
* Called when the animation is stopping
*/
protected void stopping() {
if (useCache) {
node.setCache(oldCache);
node.setCacheHint(oldCacheHint);
}
}
@Override protected void interpolate(double d) {
timeline.playFrom(Duration.seconds(d));
timeline.stop();
}
}
这是mi控制器:
将菜单移到左侧(神秘)
LeftTransition leftTransition = new LeftTransition();
leftTransition.OpenMenu(list1);
leftTransition.play();
在这里,我想把我的尺寸和#34; AnchorPane&#34 ;. (设置我的"锚定页面的宽度")
/*ViewPaneTransition paneTransition = new ViewPaneTransition();
paneTransition.CloseMenu(viewPane, width );
paneTransition.play();*/
答案 0 :(得分:1)
这是java 9的一个工作示例。它改变了宽度和高度(如果你不需要它,只需删除高度线)
widthProperty是readOnly所以你必须设置maxWidth或minWidth切换你需要的情况。 默认情况下,时间轴上的延迟持续时间为0,无需设置,并且从关键帧持续时间计算循环持续时间。
protocol SomeDelegate {
// with the completion parameter
func slideToRight(currentViewController viewController: UIViewController, completion: ((Bool)->())?)
}
extension SomeDelegate {
// without the completion parameter
func slideToRight(currentViewController viewController: UIViewController) {
slideToRight(slideToRight(currentViewController: viewController, completion: nil))
}
}
答案 1 :(得分:0)
public void changeWidth(final Pane/*Region*/ node, double width) {//its a Pane or Regions
this.node = node;
this.timeline = TimelineBuilder.create()
.keyFrames(
new KeyFrame(Duration.millis(20),
new KeyValue( going here? , width, WEB_EASE)
)
)
.build();
setCycleDuration(Duration.seconds(5));
setDelay(Duration.seconds(0));
}
在这种情况下,我的节点是“AnchorPane”。
您的AnchorPane
是子类或Pane
,让您的包装或方法接受Pane
或其各自的类