当前位置: 首页>>代码示例>>Java>>正文


Java ImageView.setRotate方法代码示例

本文整理汇总了Java中javafx.scene.image.ImageView.setRotate方法的典型用法代码示例。如果您正苦于以下问题:Java ImageView.setRotate方法的具体用法?Java ImageView.setRotate怎么用?Java ImageView.setRotate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.image.ImageView的用法示例。


在下文中一共展示了ImageView.setRotate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: drawSprite

import javafx.scene.image.ImageView; //导入方法依赖的package包/类
/**
 * Kirajzol egy TrainPartot a GraphicsContextre, elforgatva a sebessege iranyaba.
 */
private void drawSprite(TrainPart trainPart, Image sprite) {
    ImageView iv = new ImageView(sprite);
    Coordinate dir = trainPart.getDirection();
    // Az elforgatas szoget az (1,0) vektorhoz viszonyitjuk, mert vizszintesen es jobbra allva taroljuk a spriteokat
    Coordinate ref = new Coordinate(1, 0);
    double deg = Math.toDegrees(Math.acos(Coordinate.dot(dir, ref)));
    // Ha az elforgatas szoge > 180 fok, akkor is jo iranyba forgassuk
    if (Coordinate.cross(dir, ref) > 0) {
        deg = 360 - deg;
    }
    iv.setRotate(deg);
    SnapshotParameters param = new SnapshotParameters();
    param.setFill(Color.TRANSPARENT);
    Image rotatedImage = iv.snapshot(param, null);
    graphicsContext.drawImage(rotatedImage, trainPart.getPos().getX() - rotatedImage.getWidth() / 2, trainPart.getPos().getY() - rotatedImage.getHeight() / 2);
}
 
开发者ID:AdjustmentBeaver,项目名称:szoftlab,代码行数:20,代码来源:TrainView.java

示例2: RaceTrack

import javafx.scene.image.ImageView; //导入方法依赖的package包/类
public RaceTrack() {
    ImageView carImageView = new ImageView(new Image(
            DataAppPreloader.class.getResourceAsStream("images/car.png")));
    road = SVGPathBuilder.create()
            .content(trackPath).fill(null).stroke(Color.gray(0.4))
            .strokeWidth(50)
            .effect(DropShadowBuilder.create().radius(20).blurType(BlurType.ONE_PASS_BOX).build())
            .build();
    SVGPath trackLine = SVGPathBuilder.create()
            .content(trackPath).fill(null).stroke(Color.WHITE)
            .strokeDashArray(8d,6d).build();
    Line startLine = LineBuilder.create()
            .startX(610.312).startY(401.055).endX(610.312).endY(450.838)
            .stroke(Color.WHITE).strokeDashArray(2d,2d).build();
    Text startFinish = TextBuilder.create().text("START/FINISH").fill(Color.WHITE)
            .x(570).y(475).build();
    percentage = TextBuilder.create().text("0%")
            .x(390).y(170).font(Font.font("System", 60))
            .fill(Color.web("#ddf3ff"))
            .stroke(Color.web("#73c0f7"))
            .effect(DropShadowBuilder.create().radius(15).color(Color.web("#3382ba")).blurType(BlurType.ONE_PASS_BOX).build())
            .build();
    ImageView raceCarImg = new ImageView(new Image(
            DataAppPreloader.class.getResourceAsStream("images/Mini-red-and-white.png")));
    raceCarImg.setX(raceCarImg.getImage().getWidth()/2);
    raceCarImg.setY(raceCarImg.getImage().getHeight()/2);
    raceCarImg.setRotate(90);
    raceCar = new Group(raceCarImg);
    
    track = new Group(road, trackLine, startLine, startFinish);
    track.setCache(true);
    // add children
    getChildren().addAll(track, raceCar, percentage);
    
    // Create path animation that we will use to drive the car along the track
    race = new PathTransition(Duration.seconds(1), road, raceCar);
    race.setOrientation(PathTransition.OrientationType.ORTHOGONAL_TO_TANGENT);
    race.play();
    race.pause();
    
    // center our content and set our size
    setTranslateX(-road.getBoundsInLocal().getMinX());
    setTranslateY(-road.getBoundsInLocal().getMinY());
    setPrefSize(road.getBoundsInLocal().getWidth(), road.getBoundsInLocal().getHeight());
    setMaxSize(USE_PREF_SIZE, USE_PREF_SIZE);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:47,代码来源:RaceTrack.java

示例3: afficherCarte

import javafx.scene.image.ImageView; //导入方法依赖的package包/类
public void afficherCarte(String link){

        Label cardLbl = new Label("Carte jouer"+this.param.getName());

        Image img = new Image(link);

        ImageView imgView = new ImageView(img);



        imgView.setRotate(90);

        imgView.setFitHeight(500);

        imgView.setFitWidth(620);



        FXMLLoader loader = new FXMLLoader(

                getClass().getResource(

                        "/com/miage/pandemie/view/paneCard.fxml"

                )

        );



        DialogPane pane = null;

        try {

            pane = loader.load();

        } catch (IOException ex) {

            Logger.getLogger(BoardController.class.getName()).log(Level.SEVERE, null, ex);

        }



        GridPane gridImageView = (GridPane) pane.getContent();

        GridPane gridLbl = (GridPane) pane.getHeader();

        gridImageView.add(imgView, 0, 0);

        gridLbl.add(cardLbl, 0, 0);

        this.defausseInfectionImageView.setImage(img);

        Alert alert = new Alert(Alert.AlertType.INFORMATION);

        alert.setWidth(590);

        alert.setHeight(765);

        alert.setTitle("Carte jouer");

        alert.setContentText("");

        alert.setGraphic(pane);   

        alert.showAndWait();    



    }
 
开发者ID:tillind,项目名称:pandemie,代码行数:72,代码来源:BoardController.java


注:本文中的javafx.scene.image.ImageView.setRotate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。