本文整理汇总了Java中javafx.scene.shape.Circle.translateXProperty方法的典型用法代码示例。如果您正苦于以下问题:Java Circle.translateXProperty方法的具体用法?Java Circle.translateXProperty怎么用?Java Circle.translateXProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.shape.Circle
的用法示例。
在下文中一共展示了Circle.translateXProperty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createMovingCircle
import javafx.scene.shape.Circle; //导入方法依赖的package包/类
private Circle createMovingCircle(Interpolator interpolator) {
//create a transparent circle
Circle circle = new Circle(45,45, 40, Color.web("1c89f4"));
circle.setOpacity(0);
//add effect
circle.setEffect(new Lighting());
//create a timeline for moving the circle
timeline.setCycleCount(Timeline.INDEFINITE);
timeline.setAutoReverse(true);
//create a keyValue for horizontal translation of circle to the position 155px with given interpolator
KeyValue keyValue = new KeyValue(circle.translateXProperty(), 155, interpolator);
//create a keyFrame with duration 4s
KeyFrame keyFrame = new KeyFrame(Duration.seconds(4), keyValue);
//add the keyframe to the timeline
timeline.getKeyFrames().add(keyFrame);
return circle;
}
示例2: createMovingCircle
import javafx.scene.shape.Circle; //导入方法依赖的package包/类
private Circle createMovingCircle(Interpolator interpolator, Color color){
Circle circle = new Circle(25,25,35,color);
circle.setOpacity(0.0);
//add effect
circle.setEffect(new Lighting());
//create a timeline for moving the circle
timeline.setCycleCount(Timeline.INDEFINITE);
timeline.setAutoReverse(true);
//create a keyValue for horizontal translation of circle to the position 155px with given interpolator
KeyValue keyValue = new KeyValue(circle.translateXProperty(), 155, interpolator);
//create a keyFrame with duration 4s
KeyFrame keyFrame = new KeyFrame(Duration.seconds(4), keyValue);
//add the keyframe to the timeline
timeline.getKeyFrames().add(keyFrame);
return circle;
}