當前位置: 首頁>>代碼示例>>Java>>正文


Java Rotate.setAngle方法代碼示例

本文整理匯總了Java中javafx.scene.transform.Rotate.setAngle方法的典型用法代碼示例。如果您正苦於以下問題:Java Rotate.setAngle方法的具體用法?Java Rotate.setAngle怎麽用?Java Rotate.setAngle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.scene.transform.Rotate的用法示例。


在下文中一共展示了Rotate.setAngle方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: rotateSelectedObject

import javafx.scene.transform.Rotate; //導入方法依賴的package包/類
public void rotateSelectedObject(double angle, boolean createHistoryPoint) {
    GUIState guiState = mainController.getGUIController().getGuiState();

    FocusOutline focusOutline = guiState.getFocusOutline();

    Rotate rotation = new Rotate();
    rotation.setAngle(angle);

    rotation.setPivotX(focusOutline.getRotateAnchor().getCenterX());
    rotation.setPivotY(focusOutline.getRotateAnchor().getCenterY());

    focusOutline.getFocusRectangle().getTransforms().add(rotation);
    focusOutline.getRotateAnchor().getTransforms().add(rotation);

    guiState.getSelectedObject().getTransforms().add(rotation);

    for (ResizeAnchor resizeAnchor : focusOutline.getResizeAnchors()) {
        resizeAnchor.getTransforms().add(rotation);
    }

    if (createHistoryPoint) {
        HistoryController.getInstance(mainController).createHistoryPoint();
    }
}
 
開發者ID:pfolta,項目名稱:Shapify,代碼行數:25,代碼來源:Document.java

示例2: SplitFlapSkin

import javafx.scene.transform.Rotate; //導入方法依賴的package包/類
public SplitFlapSkin(final SplitFlap CONTROL) {
    super(CONTROL);
    FLIP_FINISHED         = new FlipEvent(this, getSkinnable(), FlipEvent.FLIP_FINISHED);
    selectedSet           = getSkinnable().getSelectedSet();
    currentSelectionIndex = getSkinnable().getSelectedSet().indexOf(getSkinnable().getText());
    nextSelectionIndex    = currentSelectionIndex + 1 > getSkinnable().getSelectedSet().size() ? 0 : currentSelectionIndex + 1;
    aspectRatio           = PREFERRED_HEIGHT / PREFERRED_WIDTH;
    pane                  = new Pane();
    rotateFlap            = new Rotate();
    rotateFlap.setAxis(Rotate.X_AXIS);
    rotateFlap.setAngle(0);
    flapHeight            = 0.49206349206349204 * PREFERRED_HEIGHT;
    timeline              = new Timeline();
    init();
    initGraphics();
    registerListeners();
}
 
開發者ID:Simego,項目名稱:FXImgurUploader,代碼行數:18,代碼來源:SplitFlapSkin.java

示例3: rotate3Dto

import javafx.scene.transform.Rotate; //導入方法依賴的package包/類
private void rotate3Dto(Shape3D shape, float tx, float ty, float tz){
    if (rotationToInProgress){
        return;
    }
    //System.out.printf("rotate3Dto:%s %f | %f | %f\n", shape.getId(), tx, ty, tz);
    rotationToInProgress = true;
    Rotate rxBox = new Rotate(0, 0, 0, 0, Rotate.X_AXIS);
    Rotate ryBox = new Rotate(0, 0, 0, 0, Rotate.Y_AXIS);
    Rotate rzBox = new Rotate(0, 0, 0, 0, Rotate.Z_AXIS);
    float rx = tx - originX;
    float ry = ty - originY;
    float rz = tz - originZ;

    rxBox.setAngle(rx);
    ryBox.setAngle(ry);
    rzBox.setAngle(rz);
    shape.getTransforms().addAll(rxBox, ryBox, rzBox);
    originX = tx;
    originY = ty;
    originZ = tz;
    rotationToInProgress = false;
}
 
開發者ID:BOSSoNe0013,項目名稱:UDOONeoController,代碼行數:23,代碼來源:Sensors3DViewController.java

示例4: rotate3D

import javafx.scene.transform.Rotate; //導入方法依賴的package包/類
private void rotate3D(Group shape, float rx, float ry, float rz){
    if (rotationInProgress){
        return;
    }
    //System.out.printf("rotate3D:%s %f | %f | %f\n", shape.getId(), rx, ry, rz);
    rotationInProgress = true;
    Rotate rxBox = new Rotate(0, 0, 0, 0, Rotate.X_AXIS);
    Rotate ryBox = new Rotate(0, 0, 0, 0, Rotate.Y_AXIS);
    Rotate rzBox = new Rotate(0, 0, 0, 0, Rotate.Z_AXIS);

    rxBox.setAngle(rx);
    ryBox.setAngle(ry);
    rzBox.setAngle(rz);
    shape.getTransforms().addAll(rxBox, ryBox, rzBox);
    rotationInProgress = false;
}
 
開發者ID:BOSSoNe0013,項目名稱:UDOONeoController,代碼行數:17,代碼來源:Sensors3DViewController.java

示例5: touchRotate

import javafx.scene.transform.Rotate; //導入方法依賴的package包/類
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 + getSkinnable().getMinValue():
                       (interactiveAngle - 180.0 + getSkinnable().getStartAngle() - 360) / angleStep + getSkinnable().getMinValue();
    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));
        newTarget = value.getText();
        resizeText();
    }

}
 
開發者ID:Simego,項目名稱:FXImgurUploader,代碼行數:15,代碼來源:HeatControlSkin.java

示例6: touchRotate

import javafx.scene.transform.Rotate; //導入方法依賴的package包/類
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();
    }

}
 
開發者ID:Simego,項目名稱:FXImgurUploader,代碼行數:14,代碼來源:RadialBargraphSkin.java

示例7: touchRotate

import javafx.scene.transform.Rotate; //導入方法依賴的package包/類
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 + getSkinnable().getMinValue():
                       (interactiveAngle - 180.0 + getSkinnable().getStartAngle() - 360) / angleStep + getSkinnable().getMinValue();
    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();
    }

}
 
開發者ID:Simego,項目名稱:FXImgurUploader,代碼行數:14,代碼來源:GaugeSkin.java

示例8: initGraphics

import javafx.scene.transform.Rotate; //導入方法依賴的package包/類
@Override protected void initGraphics() {
    super.initGraphics();

    timeline              = new Timeline();
    characters            = tile.getCharacterList();
    currentSelectionIndex = 0;
    nextSelectionIndex    = 1;

    centerX    = PREFERRED_WIDTH * 0.5;
    centerY    = PREFERRED_HEIGHT * 0.5;

    pane.setBackground(null);
    pane.setBorder(null);

    rotateFlap = new Rotate();
    rotateFlap.setAxis(Rotate.X_AXIS);
    rotateFlap.setAngle(0);

    flapHeight = PREFERRED_HEIGHT * 0.495;

    upperBackground    = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT * 0.495);
    upperBackgroundCtx = upperBackground.getGraphicsContext2D();

    upperBackgroundText    = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT * 0.495);
    upperBackgroundTextCtx = upperBackgroundText.getGraphicsContext2D();
    upperBackgroundTextCtx.setTextBaseline(VPos.CENTER);
    upperBackgroundTextCtx.setTextAlign(TextAlignment.CENTER);

    lowerBackground    = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT * 0.495);
    lowerBackgroundCtx = lowerBackground.getGraphicsContext2D();

    lowerBackgroundText    = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT * 0.495);
    lowerBackgroundTextCtx = lowerBackgroundText.getGraphicsContext2D();
    lowerBackgroundTextCtx.setTextBaseline(VPos.CENTER);
    lowerBackgroundTextCtx.setTextAlign(TextAlignment.CENTER);

    flap = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT * 0.495);
    flap.getTransforms().add(rotateFlap);
    flapCtx = flap.getGraphicsContext2D();

    flapTextFront = new Canvas();
    flapTextFront.getTransforms().add(rotateFlap);
    flapTextFrontCtx = flapTextFront.getGraphicsContext2D();
    flapTextFrontCtx.setTextBaseline(VPos.CENTER);
    flapTextFrontCtx.setTextAlign(TextAlignment.CENTER);

    flapTextBack  = new Canvas();
    flapTextBack.getTransforms().add(rotateFlap);
    flapTextBack.setOpacity(0);
    flapTextBackCtx = flapTextBack.getGraphicsContext2D();
    flapTextBackCtx.setTextBaseline(VPos.CENTER);
    flapTextBackCtx.setTextAlign(TextAlignment.CENTER);

    pane.getChildren().addAll(upperBackground,
                              lowerBackground,
                              upperBackgroundText,
                              lowerBackgroundText,
                              flap,
                              flapTextFront,
                              flapTextBack);
}
 
開發者ID:HanSolo,項目名稱:tilesfx,代碼行數:62,代碼來源:FlipTileSkin.java

示例9: initGraphics

import javafx.scene.transform.Rotate; //導入方法依賴的package包/類
private void initGraphics() {
    // Set initial size
    if (Double.compare(gauge.getPrefWidth(), 0.0) <= 0 || Double.compare(gauge.getPrefHeight(), 0.0) <= 0 ||
        Double.compare(gauge.getWidth(), 0.0) <= 0 || Double.compare(gauge.getHeight(), 0.0) <= 0) {
        if (gauge.getPrefWidth() > 0 && gauge.getPrefHeight() > 0) {
            gauge.setPrefSize(gauge.getPrefWidth(), gauge.getPrefHeight());
        } else {
            gauge.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    ring = new Path();
    ring.setFillRule(FillRule.EVEN_ODD);
    ring.setStroke(null);
    ring.setFill(Gauge.DARK_COLOR);
    ring.setEffect(new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(255, 255, 255, 0.35), 1, 0, 0, 1));

    sectionsCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    sectionsCtx    = sectionsCanvas.getGraphicsContext2D();

    mask = new Circle();
    mask.setStroke(null);
    mask.setFill(gauge.getBackgroundPaint());

    knob = new Circle();
    knob.setStroke(null);
    knob.setFill(gauge.getKnobColor());

    angleStep = ANGLE_RANGE / (gauge.getRange());
    double targetAngle = 180 - START_ANGLE + (gauge.getValue() - gauge.getMinValue()) * angleStep;

    needleRotate = new Rotate(180 - START_ANGLE);
    needleRotate.setAngle(Helper.clamp(180 - START_ANGLE, 180 - START_ANGLE + ANGLE_RANGE, targetAngle));

    needle = new Path();
    needle.setFillRule(FillRule.EVEN_ODD);
    needle.setStroke(null);
    needle.getTransforms().setAll(needleRotate);

    valueText = new Text(formatNumber(gauge.getLocale(), gauge.getFormatString(), gauge.getDecimals(), gauge.getMinValue()) + gauge.getUnit());
    valueText.setMouseTransparent(true);
    valueText.setTextOrigin(VPos.CENTER);
    valueText.setFill(gauge.getValueColor());
    Helper.enableNode(valueText, gauge.isValueVisible());

    titleText = new Text(gauge.getTitle());
    titleText.setTextOrigin(VPos.CENTER);
    titleText.setFill(gauge.getTitleColor());
    Helper.enableNode(titleText, !gauge.getTitle().isEmpty());

    // Add all nodes
    pane = new Pane(ring, sectionsCanvas, mask, knob, needle, valueText, titleText);

    getChildren().setAll(pane);
}
 
開發者ID:HanSolo,項目名稱:Medusa,代碼行數:56,代碼來源:SectionSkin.java

示例10: initGraphics

import javafx.scene.transform.Rotate; //導入方法依賴的package包/類
private void initGraphics() {
    // Set initial size
    if (Double.compare(gauge.getPrefWidth(), 0.0) <= 0 || Double.compare(gauge.getPrefHeight(), 0.0) <= 0 ||
        Double.compare(gauge.getWidth(), 0.0) <= 0 || Double.compare(gauge.getHeight(), 0.0) <= 0) {
        if (gauge.getPrefWidth() > 0 && gauge.getPrefHeight() > 0) {
            gauge.setPrefSize(gauge.getPrefWidth(), gauge.getPrefHeight());
        } else {
            gauge.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    sectionsCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    sectionsCtx    = sectionsCanvas.getGraphicsContext2D();

    needleRotate   = new Rotate(180 - START_ANGLE);

    angleStep          = ANGLE_RANGE / (gauge.getRange());
    double targetAngle = 180 - START_ANGLE + (gauge.getValue() - gauge.getMinValue()) * angleStep;
    needleRotate.setAngle(Helper.clamp(180 - START_ANGLE, 180 - START_ANGLE + ANGLE_RANGE, targetAngle));

    needleMoveTo1       = new MoveTo();
    needleCubicCurveTo2 = new CubicCurveTo();
    needleCubicCurveTo3 = new CubicCurveTo();
    needleCubicCurveTo4 = new CubicCurveTo();
    needleLineTo5       = new LineTo();
    needleLineTo6       = new LineTo();
    needleCubicCurveTo7 = new CubicCurveTo();
    needleClosePath8    = new ClosePath();
    needle              = new Path(needleMoveTo1, needleCubicCurveTo2, needleCubicCurveTo3, needleCubicCurveTo4, needleLineTo5, needleLineTo6, needleCubicCurveTo7, needleClosePath8);
    needle.setFillRule(FillRule.EVEN_ODD);

    needle.getTransforms().setAll(needleRotate);
    needle.setFill(gauge.getNeedleColor());
    needle.setStroke(gauge.getBorderPaint());
    needle.setStrokeLineCap(StrokeLineCap.ROUND);
    needle.setStrokeLineJoin(StrokeLineJoin.BEVEL);

    valueText = new Text(formatNumber(gauge.getLocale(), gauge.getFormatString(), gauge.getDecimals(), gauge.getMinValue()) + gauge.getUnit());
    valueText.setMouseTransparent(true);
    valueText.setTextOrigin(VPos.CENTER);
    valueText.setFill(gauge.getValueColor());
    enableNode(valueText, gauge.isValueVisible());

    titleText = new Text(gauge.getTitle());
    titleText.setTextOrigin(VPos.CENTER);
    titleText.setFill(gauge.getTitleColor());
    enableNode(titleText, !gauge.getTitle().isEmpty());

    subTitleText = new Text(gauge.getSubTitle());
    subTitleText.setTextOrigin(VPos.CENTER);
    subTitleText.setFill(gauge.getSubTitleColor());
    enableNode(subTitleText, !gauge.getSubTitle().isEmpty());

    // Add all nodes
    pane = new Pane(sectionsCanvas, needle, valueText, titleText, subTitleText);

    getChildren().setAll(pane);
}
 
開發者ID:HanSolo,項目名稱:Medusa,代碼行數:59,代碼來源:SimpleSkin.java

示例11: initGraphics

import javafx.scene.transform.Rotate; //導入方法依賴的package包/類
private void initGraphics() {                        
    innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), PREFERRED_HEIGHT * 0.1, 0, 0, 0);
    Color color = gradientLookup.getColorAt(getSkinnable().getValue() / (getSkinnable().getMaxValue() - getSkinnable().getMinValue())); 
    background = new Circle(0.5 * PREFERRED_WIDTH, 0.5 * PREFERRED_HEIGHT, 0.5 * PREFERRED_WIDTH);
    background.setFill(new LinearGradient(0, 0, 0, PREFERRED_HEIGHT,
                                          false, CycleMethod.NO_CYCLE,
                                          new Stop(0, color.deriveColor(0, 1, 0.8, 1)),
                                          new Stop(1, color.deriveColor(0, 1, 0.6, 1))));
    background.setEffect(innerShadow);

    ticksCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    ticksCanvas.setMouseTransparent(true);
    ticks = ticksCanvas.getGraphicsContext2D();

    targetIndicator = new Region();
    targetIndicator.getStyleClass().setAll("target-indicator");
    targetIndicatorRotate = new Rotate(180 - getSkinnable().getStartAngle() - getSkinnable().getMinValue() * angleStep);
    targetIndicator.getTransforms().setAll(targetIndicatorRotate);       
    targetExceeded = false;
    targetIndicator.setVisible(getSkinnable().isTargetEnabled());

    valueIndicator = new Region();
    valueIndicator.getStyleClass().setAll("value-indicator");
    valueIndicatorRotate = new Rotate(180 - getSkinnable().getStartAngle());
    valueIndicatorRotate.setAngle(valueIndicatorRotate.getAngle() + (getSkinnable().getValue() - getSkinnable().getOldValue() - getSkinnable().getMinValue()) * angleStep);
    valueIndicator.getTransforms().setAll(valueIndicatorRotate);

    infoText = new Text(getSkinnable().getInfoText().toUpperCase());
    infoText.setTextOrigin(VPos.CENTER);
    infoText.setFont(Fonts.opensansSemiBold(0.06 * PREFERRED_HEIGHT));
    infoText.setMouseTransparent(true);
    infoText.getStyleClass().setAll("info-text");        

    value = new Text(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", getSkinnable().getValue()));
    value.setMouseTransparent(true);
    value.setTextOrigin(VPos.CENTER);
    value.setFont(Fonts.opensansBold(0.32 * PREFERRED_HEIGHT));
    value.setMouseTransparent(true);
    value.getStyleClass().setAll("value");

    // Add all nodes
    pane = new Pane();
    pane.getChildren().setAll(background,                                  
                              ticksCanvas,
                              valueIndicator,
                              targetIndicator,
                              infoText,
                              value);
    
    getChildren().setAll(pane);
}
 
開發者ID:Simego,項目名稱:FXImgurUploader,代碼行數:52,代碼來源:HeatControlSkin.java

示例12: initGraphics

import javafx.scene.transform.Rotate; //導入方法依賴的package包/類
private void initGraphics() {
    Font.loadFont(getClass().getResourceAsStream("/eu/hansolo/enzo/fonts/opensans-semibold.ttf"), (0.06 * PREFERRED_HEIGHT)); // "OpenSans"

    sectionsCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    sectionsCtx    = sectionsCanvas.getGraphicsContext2D();

    measuredRangeCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    measuredRangeCanvas.setManaged(getSkinnable().isMeasuredRangeVisible());
    measuredRangeCanvas.setVisible(getSkinnable().isMeasuredRangeVisible());
    measuredRangeCtx    = measuredRangeCanvas.getGraphicsContext2D();        
    
    if (getSkinnable().getValue() < getSkinnable().getMinValue()) getSkinnable().setValue(getSkinnable().getMinValue());
    if (getSkinnable().getValue() > getSkinnable().getMaxValue()) getSkinnable().setValue(getSkinnable().getMaxValue());

    needleRotate = new Rotate(180 - getSkinnable().getStartAngle());
    if (getSkinnable().getMinValue() < 0) {
        needleRotate.setAngle(needleRotate.getAngle() + (getSkinnable().getValue() - getSkinnable().getOldValue() - getSkinnable().getMinValue()) * angleStep);
    } else {
        //needleRotate.setAngle(needleRotate.getAngle() + (getSkinnable().getValue() - getSkinnable().getOldValue() + getSkinnable().getMinValue()) * angleStep);
    }

    angleStep = getSkinnable().getAngleRange() / (getSkinnable().getMaxValue() - getSkinnable().getMinValue());
    needleRotate.setAngle(needleRotate.getAngle() + (getSkinnable().getValue() - getSkinnable().getOldValue()) * angleStep);

    needle = new Path();
    needle.setFillRule(FillRule.EVEN_ODD);
    needle.getStyleClass().setAll("needle");
    needle.getTransforms().setAll(needleRotate);       

    value = new Text(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", getSkinnable().getMinValue()) + getSkinnable().getUnit());
    value.setMouseTransparent(true);
    value.setTextOrigin(VPos.CENTER);
    value.getStyleClass().setAll("value");

    title = new Text(getSkinnable().getTitle());
    title.setTextOrigin(VPos.CENTER);
    title.getStyleClass().setAll("title");

    // Add all nodes
    pane = new Pane();
    pane.getStyleClass().add("simple-gauge");
    pane.getChildren().setAll(sectionsCanvas,
                              measuredRangeCanvas,
                              needle,
                              value,
                              title);

    getChildren().setAll(pane);
    resize();
}
 
開發者ID:Simego,項目名稱:FXImgurUploader,代碼行數:51,代碼來源:SimpleGaugeSkin.java

示例13: createMinutesContent

import javafx.scene.transform.Rotate; //導入方法依賴的package包/類
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(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);
}
 
開發者ID:jfoenixadmin,項目名稱:JFoenix,代碼行數:75,代碼來源:JFXTimePickerContent.java

示例14: buildAxes

import javafx.scene.transform.Rotate; //導入方法依賴的package包/類
private void buildAxes() {
    axisGroup.setId("axis");
    final PhongMaterial redMaterial = new PhongMaterial();
    redMaterial.setDiffuseColor(Color.RED);
    redMaterial.setSpecularColor(Color.RED);

    final PhongMaterial greenMaterial = new PhongMaterial();
    greenMaterial.setDiffuseColor(Color.GREEN);
    greenMaterial.setSpecularColor(Color.GREEN);

    final PhongMaterial blueMaterial = new PhongMaterial();
    blueMaterial.setDiffuseColor(Color.BLUE);
    blueMaterial.setSpecularColor(Color.BLUE);

    final Box xAxis = new Box(AXIS_LENGTH, 2, 1);
    final Box yAxis = new Box(1, AXIS_LENGTH, 2);
    final Box zAxis = new Box(2, 1, AXIS_LENGTH);

    final Circle xPlane = new Circle(AXIS_LENGTH/2);
    final Circle yPlane = new Circle(AXIS_LENGTH/2);
    final Circle zPlane = new Circle(AXIS_LENGTH/2);

    xPlane.setStroke(Color.RED);
    xPlane.setStrokeWidth(2);
    xPlane.setFill(Color.TRANSPARENT);

    yPlane.setStroke(Color.GREEN);
    yPlane.setStrokeWidth(2);
    yPlane.setFill(Color.TRANSPARENT);

    zPlane.setStroke(Color.BLUE);
    zPlane.setStrokeWidth(2);
    zPlane.setFill(Color.TRANSPARENT);

    yPlane.setRotationAxis(Rotate.X_AXIS);
    yPlane.setRotate(90);

    zPlane.setRotationAxis(Rotate.Y_AXIS);
    zPlane.setRotate(90);

    xAxis.setMaterial(redMaterial);
    yAxis.setMaterial(greenMaterial);
    zAxis.setMaterial(blueMaterial);

    axisGroup.getChildren().addAll(xAxis, yAxis, zAxis, xPlane, yPlane, zPlane);
    axisGroup.setVisible(true);
    axisGroup.setLayoutX(400);
    axisGroup.setLayoutY(300);
    Rotate rxBox = new Rotate(0, 0, 0, 0, Rotate.X_AXIS);
    Rotate ryBox = new Rotate(0, 0, 0, 0, Rotate.Y_AXIS);
    Rotate rzBox = new Rotate(0, 0, 0, 0, Rotate.Z_AXIS);
    Translate tzBox = new Translate(240.0, 0, 240.0);
    Double rx = 45.0;
    Double ry = -45.0;
    Double rz = 0.0;

    rxBox.setAngle(rx);
    ryBox.setAngle(ry);
    rzBox.setAngle(rz);
    axisGroup.getTransforms().addAll(tzBox, rxBox, ryBox, rzBox);
    rootPane.getChildren().addAll(axisGroup);
}
 
開發者ID:BOSSoNe0013,項目名稱:UDOONeoController,代碼行數:63,代碼來源:Sensors3DViewController.java


注:本文中的javafx.scene.transform.Rotate.setAngle方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。