javafx.scene.transform.Rotate Java Examples
The following examples show how to use
javafx.scene.transform.Rotate.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RotateInUpLeft.java From AnimateFX with Apache License 2.0 | 7 votes |
@Override void initTimeline() { getNode().setRotationAxis(Rotate.Z_AXIS); Rotate rotate = new Rotate(0, 0, getNode().getBoundsInLocal().getHeight()); getNode().getTransforms().add(rotate); setTimeline(new Timeline( new KeyFrame(Duration.millis(0), new KeyValue(rotate.angleProperty(), 45, AnimateFXInterpolator.EASE), new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE) ), new KeyFrame(Duration.millis(1000), new KeyValue(rotate.angleProperty(), 0, AnimateFXInterpolator.EASE), new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE) ) )); }
Example #2
Source File: JackInTheBox.java From AnimateFX with Apache License 2.0 | 7 votes |
@Override void initTimeline() { Rotate rotate = new Rotate(30, getNode().getBoundsInParent().getWidth() / 2, getNode().getBoundsInParent().getHeight()); getNode().getTransforms().add(rotate); setTimeline(new Timeline( new KeyFrame(Duration.millis(0), new KeyValue(rotate.angleProperty(), 30, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleXProperty(), 0.1, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleYProperty(), 0.1, AnimateFXInterpolator.EASE), new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE) ), new KeyFrame(Duration.millis(500), new KeyValue(rotate.angleProperty(), -10, AnimateFXInterpolator.EASE) ), new KeyFrame(Duration.millis(700), new KeyValue(rotate.angleProperty(), 3, AnimateFXInterpolator.EASE) ), new KeyFrame(Duration.millis(1000), new KeyValue(getNode().scaleXProperty(), 1, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleYProperty(), 1, AnimateFXInterpolator.EASE), new KeyValue(rotate.angleProperty(), 0, AnimateFXInterpolator.EASE), new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE) ) )); }
Example #3
Source File: RotateInDownLeft.java From AnimateFX with Apache License 2.0 | 6 votes |
@Override void initTimeline() { getNode().setRotationAxis(Rotate.Z_AXIS); Rotate rotate = new Rotate(0, 0, getNode().getBoundsInLocal().getHeight()); getNode().getTransforms().add(rotate); setTimeline(new Timeline( new KeyFrame(Duration.millis(0), new KeyValue(rotate.angleProperty(), -45, AnimateFXInterpolator.EASE), new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE) ), new KeyFrame(Duration.millis(1000), new KeyValue(rotate.angleProperty(), 0, AnimateFXInterpolator.EASE), new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE) ) )); }
Example #4
Source File: JavaFX3D.java From JavaFX-Tutorial-Codes with Apache License 2.0 | 6 votes |
private void initMouseControl(SmartGroup group, Scene scene) { Rotate xRotate; Rotate yRotate; group.getTransforms().addAll( xRotate = new Rotate(0, Rotate.X_AXIS), yRotate = new Rotate(0, Rotate.Y_AXIS) ); xRotate.angleProperty().bind(angleX); yRotate.angleProperty().bind(angleY); scene.setOnMousePressed(event -> { anchorX = event.getSceneX(); anchorY = event.getSceneY(); anchorAngleX = angleX.get(); anchorAngleY = angleY.get(); }); scene.setOnMouseDragged(event -> { angleX.set(anchorAngleX - (anchorY - event.getSceneY())); angleY.set(anchorAngleY + anchorX - event.getSceneX()); }); }
Example #5
Source File: TagBase.java From OpenLabeler with Apache License 2.0 | 6 votes |
public void move(HorizontalDirection horizontal, VerticalDirection vertical, double deltaX, double deltaY) { Rotate rotate = AppUtils.getTransform(this, Rotate.class); double x = horizontal == null ? 0 : (horizontal == HorizontalDirection.LEFT ? -deltaX : deltaX); double y = vertical == null ? 0 : (vertical == VerticalDirection.UP ? -deltaY : deltaY); final double x1 = horizontal == null ? 0 : (horizontal == HorizontalDirection.LEFT ? deltaX : -deltaX); final double y1 = vertical == null ? 0 : (vertical == VerticalDirection.UP ? deltaY : -deltaY); switch ((int)rotate.getAngle()) { case 90: x = y; y = x1; break; case 180: x = x1; y = y1; break; case 270: x = y1; y = x; break; } setLocation(shapeItem.getX() + x, shapeItem.getY() + y); shapeProperty.set(shapeItem.createCopy()); }
Example #6
Source File: Curbstone3D.java From SmartCity-ParkingManagement with Apache License 2.0 | 6 votes |
public Curbstone(final double size, final Color color, final double shade) { getTransforms().addAll(rz, ry, rx); getChildren().addAll( RectangleBuilder.create() // back face .width(2 * size).height(size).fill(color.deriveColor(0.0, 1.0, 1 - 0.5 * shade, 1.0)) .translateX(-0.5 * size).translateY(-0.5 * size).translateZ(0.5 * size).build(), RectangleBuilder.create() // bottom face .width(2 * size).height(size).fill(color.deriveColor(0.0, 1.0, 1 - 0.4 * shade, 1.0)) .translateX(-0.5 * size).translateY(0).rotationAxis(Rotate.X_AXIS).rotate(90).build(), RectangleBuilder.create() // right face .width(size).height(size).fill(Color.GRAY.deriveColor(0.0, 1.0, 1 - 0.3 * shade, 1.0)) .translateX(-1 * size).translateY(-0.5 * size).rotationAxis(Rotate.Y_AXIS).rotate(90) .build(), RectangleBuilder.create() // left face .width(size).height(size).fill(Color.GRAY.deriveColor(0.0, 1.0, 1 - 0.2 * shade, 1.0)) .translateX(size).translateY(-0.5 * size).rotationAxis(Rotate.Y_AXIS).rotate(90).build(), RectangleBuilder.create() // top face .width(2 * size).height(size).fill(color.deriveColor(0.0, 1.0, 1 - 0.1 * shade, 1.0)) .translateX(-0.5 * size).translateY(-1 * size).rotationAxis(Rotate.X_AXIS).rotate(90) .build(), RectangleBuilder.create() // top face .width(2 * size).height(size).fill(color).translateX(-0.5 * size).translateY(-0.5 * size) .translateZ(-0.5 * size).build()); }
Example #7
Source File: OrganView.java From narjillos with MIT License | 6 votes |
private Shape getShape(double zoomLevel, boolean effectsOn) { segment.setWidth(organ.getLength() + getOverlap() * 2); segment.setHeight(organ.getThickness()); segment.getTransforms().clear(); // overlap slightly and shift to center based on thickness double widthCenter = organ.getThickness() / 2; segment.getTransforms().add(moveToStartPoint()); segment.getTransforms().add(new Translate(-getOverlap(), -widthCenter)); segment.getTransforms().add(new Rotate(organ.getAbsoluteAngle(), getOverlap(), widthCenter)); boolean isHighDetail = hasJoint && zoomLevel >= VERY_HIGH_MAGNIFICATION && effectsOn; if (!isHighDetail) return segment; joint.setRadius(getJointRadius(organ.getThickness())); joint.getTransforms().clear(); joint.getTransforms().add(moveToStartPoint()); joint.getTransforms().add(new Translate(organ.getLength(), 0)); joint.getTransforms().add(new Rotate(organ.getAbsoluteAngle(), -organ.getLength(), 0)); return Path.union(segment, joint); }
Example #8
Source File: PearClockSkin.java From Medusa with Apache License 2.0 | 6 votes |
public PearClockSkin(Clock clock) { super(clock); minuteRotate = new Rotate(); hourRotate = new Rotate(); secondRotate = new Rotate(); sections = clock.getSections(); areas = clock.getAreas(); sections = clock.getSections(); highlightSections = clock.isHighlightSections(); sectionsVisible = clock.getSectionsVisible(); areas = clock.getAreas(); highlightAreas = clock.isHighlightAreas(); areasVisible = clock.getAreasVisible(); dateTimeFormatter = DateTimeFormatter.ofPattern("EEEE\ndd.MM.YYYY\nHH:mm:ss").withLocale(clock.getLocale()); dateTextFormatter = DateTimeFormatter.ofPattern("EE").withLocale(clock.getLocale()); updateAlarms(); initGraphics(); registerListeners(); }
Example #9
Source File: PlainClockSkin.java From Medusa with Apache License 2.0 | 6 votes |
public PlainClockSkin(Clock clock) { super(clock); minuteRotate = new Rotate(); hourRotate = new Rotate(); secondRotate = new Rotate(); sections = clock.getSections(); areas = clock.getAreas(); sections = clock.getSections(); highlightSections = clock.isHighlightSections(); sectionsVisible = clock.getSectionsVisible(); areas = clock.getAreas(); highlightAreas = clock.isHighlightAreas(); areasVisible = clock.getAreasVisible(); updateAlarms(); initGraphics(); registerListeners(); }
Example #10
Source File: IndustrialClockSkin.java From Medusa with Apache License 2.0 | 6 votes |
public IndustrialClockSkin(Clock clock) { super(clock); minuteRotate = new Rotate(); hourRotate = new Rotate(); secondRotate = new Rotate(); sections = clock.getSections(); areas = clock.getAreas(); sections = clock.getSections(); highlightSections = clock.isHighlightSections(); sectionsVisible = clock.getSectionsVisible(); areas = clock.getAreas(); highlightAreas = clock.isHighlightAreas(); areasVisible = clock.getAreasVisible(); dateTimeFormatter = DateTimeFormatter.ofPattern("EEEE\ndd.MM.YYYY\nHH:mm:ss").withLocale(clock.getLocale()); dateTextFormatter = DateTimeFormatter.ofPattern("EE").withLocale(clock.getLocale()); updateAlarms(); initGraphics(); registerListeners(); }
Example #11
Source File: SmartGraphEdgeCurve.java From JavaFXSmartGraph with MIT License | 6 votes |
@Override public void attachArrow(SmartArrow arrow) { this.attachedArrow = arrow; /* attach arrow to line's endpoint */ arrow.translateXProperty().bind(endXProperty()); arrow.translateYProperty().bind(endYProperty()); /* rotate arrow around itself based on this line's angle */ Rotate rotation = new Rotate(); rotation.pivotXProperty().bind(translateXProperty()); rotation.pivotYProperty().bind(translateYProperty()); rotation.angleProperty().bind(UtilitiesBindings.toDegrees( UtilitiesBindings.atan2(endYProperty().subtract(controlY2Property()), endXProperty().subtract(controlX2Property())) )); arrow.getTransforms().add(rotation); /* add translation transform to put the arrow touching the circle's bounds */ Translate t = new Translate(-outbound.getRadius(), 0); arrow.getTransforms().add(t); }
Example #12
Source File: TestBorder.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@Test public void testRotateRectangle() { Cmds.of(addRec, selectAllShapes).execute(); final Point pt1 = ShapeFactory.INST.createPoint(point(border.rotHandler).query()); final Point gc = ShapeFactory.INST.createPoint(point(getPane().getChildren().get(0)).query()); Cmds.of(rotateDown).execute(); final double a1 = ShapeFactory.INST.createLine(pt1, gc).getLineAngle(); final double a2 = 2d * Math.PI - ShapeFactory.INST.createLine(ShapeFactory.INST.createPoint(pt1.getX() + txDown, pt1.getY() + tyDown), gc).getLineAngle(); assertFalse("No rotation", ((ViewRectangle) canvas.getSelectedViews().get(0)).getBorder().getTransforms().isEmpty()); assertEquals(a1 + a2, ((Shape) getPane().getChildren().get(0).getUserData()).getRotationAngle(), 0.01); assertEquals(Math.toDegrees(a1 + a2), ((Rotate) ((ViewRectangle) canvas.getSelectedViews().get(0)).getBorder().getTransforms().get(0)).getAngle(), 1d); }
Example #13
Source File: RotateOut.java From AnimateFX with Apache License 2.0 | 5 votes |
@Override void initTimeline() { getNode().setRotationAxis(Rotate.Z_AXIS); setTimeline(new Timeline( new KeyFrame(Duration.millis(0), new KeyValue(getNode().rotateProperty(), 0, AnimateFXInterpolator.EASE), new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE) ), new KeyFrame(Duration.millis(1000), new KeyValue(getNode().rotateProperty(), 200, AnimateFXInterpolator.EASE), new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE) ) )); }
Example #14
Source File: RadialBargraphSkin.java From Enzo with Apache License 2.0 | 5 votes |
private void touchRotate(final double X, final double Y, final Rotate ROTATE) { double theta = getTheta(X, Y); interactiveAngle = (theta + 90) % 360; double newValue = Double.compare(interactiveAngle, 180) <= 0 ? (interactiveAngle + 180.0 + getSkinnable().getStartAngle() - 360) / angleStep : (interactiveAngle - 180.0 + getSkinnable().getStartAngle() - 360) / angleStep; if (Double.compare(newValue, getSkinnable().getMinValue()) >= 0 && Double.compare(newValue, getSkinnable().getMaxValue()) <= 0) { ROTATE.setAngle(interactiveAngle); value.setText(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", newValue)); resizeText(); } }
Example #15
Source File: CubeWorld.java From FXyzLib with GNU General Public License v3.0 | 5 votes |
private void buildPanels(double size) { //@SMP TODO might be easier to just replace the Rectangle side panels with really flat Box 3D objects x1AxisRectangle = new Rectangle(size, size, panelWallColor); x2AxisRectangle = new Rectangle(size, size, panelWallColor); y1AxisRectangle = new Rectangle(size, size, panelWallColor); y2AxisRectangle = new Rectangle(size, size, panelWallColor); z1AxisRectangle = new Rectangle(size, size, panelFloorColor); z2AxisRectangle = new Rectangle(size, size, panelCeilingColor); x1AxisRectangle.setTranslateX(-size / 2); x1AxisRectangle.setTranslateY(-size / 2); x1AxisRectangle.setTranslateZ(-size / 2); x2AxisRectangle.setTranslateX(-size / 2); x2AxisRectangle.setTranslateY(-size / 2); x2AxisRectangle.setTranslateZ(size / 2); getChildren().addAll(x1AxisRectangle, x2AxisRectangle); y2AxisRectangle.setTranslateY(-size / 2); y2AxisRectangle.setRotationAxis(Rotate.Y_AXIS); y2AxisRectangle.setRotate(89.9); y1AxisRectangle.setTranslateX(-size); y1AxisRectangle.setTranslateY(-size / 2); y1AxisRectangle.setRotationAxis(Rotate.Y_AXIS); y1AxisRectangle.setRotate(89.9); getChildren().addAll(y1AxisRectangle, y2AxisRectangle); z1AxisRectangle.setTranslateX(-size / 2); z1AxisRectangle.setRotationAxis(Rotate.X_AXIS); z1AxisRectangle.setRotate(89.9); z2AxisRectangle.setTranslateX(-size / 2); z2AxisRectangle.setTranslateY(-size); z2AxisRectangle.setRotationAxis(Rotate.X_AXIS); z2AxisRectangle.setRotate(89.9); getChildren().addAll(z1AxisRectangle, z2AxisRectangle); }
Example #16
Source File: RotateOutUpLeft.java From AnimateFX with Apache License 2.0 | 5 votes |
@Override void initTimeline() { rotate = new Rotate(0, 0, getNode().getBoundsInLocal().getHeight()); getNode().getTransforms().add(rotate); setTimeline(new Timeline( new KeyFrame(Duration.millis(0), new KeyValue(rotate.angleProperty(), 0, AnimateFXInterpolator.EASE), new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE) ), new KeyFrame(Duration.millis(1000), new KeyValue(rotate.angleProperty(), -45, AnimateFXInterpolator.EASE), new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE) ) )); }
Example #17
Source File: RotateIn.java From AnimateFX with Apache License 2.0 | 5 votes |
@Override void initTimeline() { getNode().setRotationAxis(Rotate.Z_AXIS); setTimeline(new Timeline( new KeyFrame(Duration.millis(0), new KeyValue(getNode().rotateProperty(), -200, AnimateFXInterpolator.EASE), new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE) ), new KeyFrame(Duration.millis(1000), new KeyValue(getNode().rotateProperty(), 0, AnimateFXInterpolator.EASE), new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE) ) )); }
Example #18
Source File: AudioVisualizerSample.java From marathonv5 with Apache License 2.0 | 5 votes |
@Override public Node create3dContent() { Xform sceneRoot = new Xform(); cubeXform = new Xform[128]; cube = new Cube[128]; int i; for (i = 0; i < 128; i++) { cubeXform[i] = new Xform(); cubeXform[i].setTranslateX((double) 2); cube[i] = new Cube(1.0, Color.hsb((double) i*1.2, 1.0, 1.0, 0.3), 1.0); if (i == 0) { sceneRoot.getChildren().add(cubeXform[i]); } else if (i >= 1) { cubeXform[i-1].getChildren().add(cubeXform[i]); } cubeXform[i].getChildren().add(cube[i]); } audioSpectrumListener = this; getAudioMediaPlayer().setAudioSpectrumListener(audioSpectrumListener); getAudioMediaPlayer().play(); getAudioMediaPlayer().setAudioSpectrumInterval(0.02); getAudioMediaPlayer().setAudioSpectrumNumBands(128); getAudioMediaPlayer().setCycleCount(Timeline.INDEFINITE); sceneRoot.setRotationAxis(Rotate.X_AXIS); sceneRoot.setRotate(180.0); sceneRoot.setTranslateY(-100.0); return sceneRoot; }
Example #19
Source File: Gauge.java From Enzo with Apache License 2.0 | 5 votes |
public final void addMarker(final Marker MARKER) { if (!markers.keySet().contains(MARKER)) { Rotate markerRotate = new Rotate(180 - getStartAngle()); MARKER.getTransforms().setAll(markerRotate); MARKER.getStyleClass().add("marker" + markers.size()); markers.put(MARKER, markerRotate); } }
Example #20
Source File: AudioVisualizerSample.java From marathonv5 with Apache License 2.0 | 5 votes |
@Override public Node create3dContent() { Xform sceneRoot = new Xform(); cubeXform = new Xform[128]; cube = new Cube[128]; int i; for (i = 0; i < 128; i++) { cubeXform[i] = new Xform(); cubeXform[i].setTranslateX((double) 2); cube[i] = new Cube(1.0, Color.hsb((double) i*1.2, 1.0, 1.0, 0.3), 1.0); if (i == 0) { sceneRoot.getChildren().add(cubeXform[i]); } else if (i >= 1) { cubeXform[i-1].getChildren().add(cubeXform[i]); } cubeXform[i].getChildren().add(cube[i]); } audioSpectrumListener = this; getAudioMediaPlayer().setAudioSpectrumListener(audioSpectrumListener); getAudioMediaPlayer().play(); getAudioMediaPlayer().setAudioSpectrumInterval(0.02); getAudioMediaPlayer().setAudioSpectrumNumBands(128); getAudioMediaPlayer().setCycleCount(Timeline.INDEFINITE); sceneRoot.setRotationAxis(Rotate.X_AXIS); sceneRoot.setRotate(180.0); sceneRoot.setTranslateY(-100.0); return sceneRoot; }
Example #21
Source File: Swing.java From AnimateFX with Apache License 2.0 | 5 votes |
@Override void initTimeline() { Rotate rotation = new Rotate(); rotation.setPivotX(getNode().getLayoutBounds().getWidth() / 2.0); rotation.setPivotY(-getNode().getLayoutBounds().getHeight()); getNode().getTransforms().add(rotation); setTimeline(new Timeline( new KeyFrame(Duration.millis(0), new KeyValue(rotation.angleProperty(), 0, AnimateFXInterpolator.EASE) ), new KeyFrame(Duration.millis(200), new KeyValue(rotation.angleProperty(), 15, AnimateFXInterpolator.EASE) ), new KeyFrame(Duration.millis(400), new KeyValue(rotation.angleProperty(), -10, AnimateFXInterpolator.EASE) ), new KeyFrame(Duration.millis(600), new KeyValue(rotation.angleProperty(), 5, AnimateFXInterpolator.EASE) ), new KeyFrame(Duration.millis(800), new KeyValue(rotation.angleProperty(), -5, AnimateFXInterpolator.EASE) ), new KeyFrame(Duration.millis(1000), new KeyValue(rotation.angleProperty(), 0, AnimateFXInterpolator.EASE) ) )); }
Example #22
Source File: ViewArrow.java From latexdraw with GNU General Public License v3.0 | 5 votes |
@Override public void updatePath(final boolean isShadow) { path.setStrokeLineCap(StrokeLineCap.BUTT); path.getElements().clear(); path.fillProperty().unbind(); path.strokeWidthProperty().unbind(); path.getTransforms().clear(); ellipse.getTransforms().clear(); arc.getTransforms().clear(); GenericViewArrow.super.updatePath(isShadow); final Line line = arrow.getArrowLine(); final double lineAngle = (-line.getLineAngle() + Math.PI * 2d) % (Math.PI * 2d); if(arrow.getArrowStyle() != ArrowStyle.NONE && !MathUtils.INST.equalsDouble(lineAngle, 0d)) { final Rotate rotate = new Rotate(Math.toDegrees(lineAngle), 0d, 0d); path.getTransforms().add(rotate); ellipse.getTransforms().add(rotate); arc.getTransforms().add(rotate); } }
Example #23
Source File: OctahedronTest.java From FXyzLib with GNU General Public License v3.0 | 5 votes |
private void generateShapes() { for (int i = 0; i < 100; i++) { Random r = new Random(); //A lot of magic numbers in here that just artificially constrain the math float randomHypotenuse = (float) ((r.nextFloat()*300) + 25); float randomHeight = (float) ((r.nextFloat()*200)+ 25); Color randomColor = new Color(r.nextDouble(), r.nextDouble(), r.nextDouble(), r.nextDouble()); Octahedron octahedron = new Octahedron(randomHypotenuse, randomHeight, randomColor); octahedron.setEmissiveLightingColor(randomColor); octahedron.setEmissiveLightingOn(r.nextBoolean()); octahedron.setDrawMode(r.nextBoolean() ? DrawMode.FILL : DrawMode.LINE); double translationX = Math.random() * 1024; if (Math.random() >= 0.5) { translationX *= -1; } double translationY = Math.random() * 1024; if (Math.random() >= 0.5) { translationY *= -1; } double translationZ = Math.random() * 1024; if (Math.random() >= 0.5) { translationZ *= -1; } Translate translate = new Translate(translationX, translationY, translationZ); Rotate rotateX = new Rotate(Math.random() * 360, Rotate.X_AXIS); Rotate rotateY = new Rotate(Math.random() * 360, Rotate.Y_AXIS); Rotate rotateZ = new Rotate(Math.random() * 360, Rotate.Z_AXIS); octahedron.getTransforms().addAll(translate, rotateX, rotateY, rotateZ); shapeGroup.getChildren().add(octahedron); } }
Example #24
Source File: CubeSystem3D.java From netbeans with Apache License 2.0 | 5 votes |
private void init(Stage primaryStage) { Group root = new Group(); root.setDepthTest(DepthTest.ENABLE); primaryStage.setResizable(false); primaryStage.setScene(new Scene(root, 500, 500, true)); primaryStage.getScene().setCamera(new PerspectiveCamera()); root.getTransforms().addAll( new Translate(500 / 2, 500 / 2), new Rotate(180, Rotate.X_AXIS) ); root.getChildren().add(create3dContent()); }
Example #25
Source File: ProgressBarRepresentation.java From phoebus with Eclipse Public License 1.0 | 5 votes |
@Override public void updateChanges() { super.updateChanges(); if (dirty_look.checkAndClear()) { boolean horizontal = model_widget.propHorizontal().getValue(); double width = model_widget.propWidth().getValue(); double height = model_widget.propHeight().getValue(); if (!horizontal) { jfx_node.getTransforms().setAll( new Translate(0, height), new Rotate(-90, 0, 0)); jfx_node.setPrefSize(height, width); } else { jfx_node.getTransforms().clear(); jfx_node.setPrefSize(width, height); } // Default 'inset' of .bar uses 7 pixels. // A widget sized 15 has 8 pixels left for the bar. // Select leaner style where .bar uses full size. Styles.update(jfx_node, "SmallBar", Math.min(width, height) <= 15); // Could clear style and use setBackground(), // but result is very plain. // Tweaking the color used by CSS keeps overall style. // See also http://stackoverflow.com/questions/13467259/javafx-how-to-change-progressbar-color-dynamically final StringBuilder style = new StringBuilder(); style.append("-fx-accent: ").append(JFXUtil.webRGB(model_widget.propFillColor().getValue())).append(';'); style.append("-fx-control-inner-background: ").append(JFXUtil.webRGB(model_widget.propBackgroundColor().getValue())).append(';'); jfx_node.setStyle(style.toString()); } if (dirty_value.checkAndClear()) jfx_node.setProgress(percentage); }
Example #26
Source File: Fx3DStageController.java From mzmine2 with GNU General Public License v2.0 | 5 votes |
private void setRtAxis() { axes.getRtAxis().getChildren().clear(); double rtDelta = (rtRange.upperEndpoint() - rtRange.lowerEndpoint()) / 7; double rtScaleValue = rtRange.upperEndpoint(); Text rtLabel = new Text("Retention Time"); rtLabel.setRotationAxis(Rotate.X_AXIS); rtLabel.setRotate(-45); rtLabel.setTranslateX(SIZE * 3 / 8); rtLabel.setTranslateZ(-25); rtLabel.setTranslateY(13); axes.getRtAxis().getChildren().add(rtLabel); for (int y = 0; y <= SIZE; y += SIZE / 7) { Line tickLineX = new Line(0, 0, 0, 9); tickLineX.setRotationAxis(Rotate.X_AXIS); tickLineX.setRotate(-90); tickLineX.setTranslateY(-5); tickLineX.setTranslateX(y); tickLineX.setTranslateZ(-3.5); float roundOff = (float) (Math.round(rtScaleValue * 10.0) / 10.0); Text text = new Text("" + (float) roundOff); text.setRotationAxis(Rotate.X_AXIS); text.setRotate(-45); text.setTranslateY(9); text.setTranslateX(y - 5); text.setTranslateZ(-15); rtScaleValue -= rtDelta; axes.getRtAxis().getChildren().addAll(text, tickLineX); } Line lineX = new Line(0, 0, SIZE, 0); axes.getRtAxis().getChildren().add(lineX); axes.getRtRotate().setAngle(180); axes.getRtTranslate().setZ(-SIZE); axes.getRtTranslate().setX(-SIZE); }
Example #27
Source File: BowlerStudio3dEngine.java From BowlerStudio with GNU General Public License v3.0 | 5 votes |
/** * Builds the camera. */ private void buildCamera() { CSG cylinder = new Cylinder(0, // Radius at the top 2.5, // Radius at the bottom 10, // Height (int) 20 // resolution ).toCSG().roty(90).setColor(Color.BLACK); hand = new Group(cylinder.getMesh()); camera.setNearClip(.1); camera.setFarClip(100000.0); getSubScene().setCamera(camera); camera.setRotationAxis(Rotate.Z_AXIS); camera.setRotate(180); setVirtualcam(new VirtualCameraDevice(camera, hand)); VirtualCameraFactory.setFactory(new IVirtualCameraFactory() { @Override public AbstractImageProvider getVirtualCamera() { return virtualcam; } }); try { setFlyingCamera(new VirtualCameraMobileBase()); } catch (Exception e) { e.printStackTrace(); } // TODO reorent the start camera moveCamera(new TransformNR(0, 0, 0, new RotationNR(90 - 127, 24, 0)), 0); defautcameraView = getFlyingCamera().getFiducialToGlobalTransform(); }
Example #28
Source File: PeerInfoWithTagEditor.java From bisq with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void animateHide(Runnable onFinishedHandler) { if (GlobalSettings.getUseAnimations()) { double duration = getDuration(300); Interpolator interpolator = Interpolator.SPLINE(0.25, 0.1, 0.25, 1); gridPane.setRotationAxis(Rotate.X_AXIS); Camera camera = gridPane.getScene().getCamera(); gridPane.getScene().setCamera(new PerspectiveCamera()); Timeline timeline = new Timeline(); ObservableList<KeyFrame> keyFrames = timeline.getKeyFrames(); keyFrames.add(new KeyFrame(Duration.millis(0), new KeyValue(gridPane.rotateProperty(), 0, interpolator), new KeyValue(gridPane.opacityProperty(), 1, interpolator) )); keyFrames.add(new KeyFrame(Duration.millis(duration), new KeyValue(gridPane.rotateProperty(), -90, interpolator), new KeyValue(gridPane.opacityProperty(), 0, interpolator) )); timeline.setOnFinished(event -> { gridPane.setRotate(0); gridPane.setRotationAxis(Rotate.Z_AXIS); gridPane.getScene().setCamera(camera); onFinishedHandler.run(); }); timeline.play(); } else { onFinishedHandler.run(); } }
Example #29
Source File: TileClockSkin.java From Medusa with Apache License 2.0 | 5 votes |
public TileClockSkin(Clock gauge) { super(gauge); minuteRotate = new Rotate(); hourRotate = new Rotate(); secondRotate = new Rotate(); initGraphics(); registerListeners(); }
Example #30
Source File: JFXTimePickerContent.java From JFoenix with Apache License 2.0 | 5 votes |
private StackPane createMinutesContent(LocalTime time) { // create minutes content StackPane minsPointer = new StackPane(); Circle selectionCircle = new Circle(contentCircleRadius / 6); selectionCircle.fillProperty().bind(timePicker.defaultColorProperty()); Circle minCircle = new Circle(selectionCircle.getRadius() / 8); minCircle.setFill(Color.rgb(255, 255, 255, 0.87)); minCircle.setTranslateX(selectionCircle.getRadius() - minCircle.getRadius()); minCircle.setVisible(time.getMinute() % 5 != 0); selectedMinLabel.textProperty().addListener((o, oldVal, newVal) -> { if (Integer.parseInt(newVal) % 5 == 0) { minCircle.setVisible(false); } else { minCircle.setVisible(true); } }); double shift = 9; Line line = new Line(shift, 0, contentCircleRadius, 0); line.fillProperty().bind(timePicker.defaultColorProperty()); line.strokeProperty().bind(line.fillProperty()); line.setStrokeWidth(1.5); minsPointer.getChildren().addAll(line, selectionCircle, minCircle); StackPane.setAlignment(selectionCircle, Pos.CENTER_LEFT); StackPane.setAlignment(minCircle, Pos.CENTER_LEFT); Group pointerGroup = new Group(); pointerGroup.getChildren().add(minsPointer); pointerGroup.setTranslateX((-contentCircleRadius + shift) / 2); minsPointerRotate = new Rotate(0, contentCircleRadius - shift, selectionCircle.getRadius()); pointerGroup.getTransforms().add(minsPointerRotate); Pane clockLabelsContainer = new Pane(); // inner circle radius double radius = contentCircleRadius - shift - selectionCircle.getRadius(); for (int i = 0; i < 12; i++) { StackPane labelContainer = new StackPane(); int val = ((i + 3) * 5) % 60; Label label = new Label(String.valueOf(unitConverter.toString(val))); label.setFont(Font.font(ROBOTO, FontWeight.BOLD, 12)); // init label color label.setTextFill(val == time.getMinute() ? Color.rgb(255, 255, 255, 0.87) : Color.rgb(0, 0, 0, 0.87)); selectedMinLabel.textProperty().addListener((o, oldVal, newVal) -> { if (Integer.parseInt(newVal) == Integer.parseInt(label.getText())) { label.setTextFill(Color.rgb(255, 255, 255, 0.87)); } else { label.setTextFill(Color.rgb(0, 0, 0, 0.87)); } }); labelContainer.getChildren().add(label); double labelSize = (selectionCircle.getRadius() / Math.sqrt(2)) * 2; labelContainer.setMinSize(labelSize, labelSize); double angle = 2 * i * Math.PI / 12; double xOffset = radius * Math.cos(angle); double yOffset = radius * Math.sin(angle); final double startx = contentCircleRadius + xOffset; final double starty = contentCircleRadius + yOffset; labelContainer.setLayoutX(startx - labelContainer.getMinWidth() / 2); labelContainer.setLayoutY(starty - labelContainer.getMinHeight() / 2); // add label to the parent node clockLabelsContainer.getChildren().add(labelContainer); } minsPointerRotate.setAngle(180 + (time.getMinute() + 45) % 60 * Math.toDegrees(2 * Math.PI / 60)); return new StackPane(pointerGroup, clockLabelsContainer); }