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


Java ImageView.setOpacity方法代碼示例

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


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

示例1: SimpleHeatMap

import javafx.scene.image.ImageView; //導入方法依賴的package包/類
public SimpleHeatMap(final double WIDTH, final double HEIGHT, ColorMapping COLOR_MAPPING, final double EVENT_RADIUS, final boolean FADE_COLORS) {
    SNAPSHOT_PARAMETERS.setFill(Color.TRANSPARENT);
    colorMapping        = COLOR_MAPPING;
    mappingGradient     = colorMapping.mapping;
    fadeColors          = FADE_COLORS;
    radius              = EVENT_RADIUS;
    opacityDistribution = OpacityDistribution.CUSTOM;
    eventImage          = createEventImage(radius, opacityDistribution);
    monochromeCanvas    = new Canvas(WIDTH, HEIGHT);
    ctx                 = monochromeCanvas.getGraphicsContext2D();
    monochromeImage     = new WritableImage((int) WIDTH, (int) HEIGHT);
    heatMapView         = new ImageView(heatMap);
    heatMapView.setMouseTransparent(true);
    heatMapView.setOpacity(0.5);
}
 
開發者ID:HanSolo,項目名稱:worldheatmap,代碼行數:16,代碼來源:SimpleHeatMap.java

示例2: Splash

import javafx.scene.image.ImageView; //導入方法依賴的package包/類
Splash() {
    state = STATE_SHOW_TITLE;
    stateArg = 0;
    initTimeline();
    background = new ImageView();
    background.setFocusTraversable(true);
    background.setImage(Config.getImages().get(Config.IMAGE_BACKGROUND));
    background.setFitWidth(Config.SCREEN_WIDTH);
    background.setFitHeight(Config.SCREEN_HEIGHT);
    background.setOnMousePressed(new EventHandler<MouseEvent>() {
        public void handle(MouseEvent me) {
            Main.getMainFrame().startGame();
        }
    });
    background.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            Main.getMainFrame().startGame();
        }
    });
    brick = new ImageView();
    brick.setImage(Config.getImages().get(Config.IMAGE_SPLASH_BRICK));
    brick.setTranslateX(-1000);
    brick.setTranslateY(brick.getImage().getHeight());
    brickShadow = new ImageView();
    brickShadow.setImage(Config.getImages().get(Config.IMAGE_SPLASH_BRICKSHADOW));
    brickShadow.setTranslateX(-1000);
    breaker = new ImageView();
    breaker.setImage(Config.getImages().get(Config.IMAGE_SPLASH_BREAKER));
    breaker.setTranslateX(-1000);
    breaker.setTranslateY(brick.getTranslateY() + brick.getImage().getHeight() * 5 / 4);
    breakerShadow = new ImageView();
    breakerShadow.setImage(Config.getImages().get(Config.IMAGE_SPLASH_BREAKERSHADOW));
    breakerShadow.setTranslateX(-1000);
    strike = new ImageView();
    strike.setImage(Config.getImages().get(Config.IMAGE_SPLASH_STRIKE));
    strike.setTranslateY(brick.getTranslateY() -
        (strike.getImage().getHeight() - brick.getImage().getHeight()) / 2);
    strike.setVisible(false);
    pressanykey = new ImageView();
    pressanykey.setImage(Config.getImages().get(Config.IMAGE_SPLASH_PRESSANYKEY));
    pressanykey.setTranslateX((Config.SCREEN_WIDTH - pressanykey.getImage().getWidth()) / 2);
    double y = breaker.getTranslateY() + breaker.getImage().getHeight();
    pressanykey.setTranslateY(y + (Config.SCREEN_HEIGHT - y) / 2);
    pressanykey.setOpacity(0);
    strikeShadow = new ImageView();
    strikeShadow.setImage(Config.getImages().get(Config.IMAGE_SPLASH_STRIKESHADOW));
    strikeShadow.setTranslateX(-1000);
    pressanykeyShadow = new ImageView();
    pressanykeyShadow.setImage(Config.getImages().get(Config.IMAGE_SPLASH_PRESSANYKEYSHADOW));
    pressanykeyShadow.setTranslateX(-1000);
    sun = new ImageView();
    sun.setImage(Config.getImages().get(Config.IMAGE_SPLASH_SUN));
    sun.setTranslateX(-1000);
    NODES = new ImageView[] {brick, breaker, strike, pressanykey};
    NODES_SHADOWS = new ImageView[] {brickShadow, breakerShadow, strikeShadow, pressanykeyShadow};
    Group group = new Group();
    group.getChildren().add(background);
    group.getChildren().addAll(NODES_SHADOWS);
    group.getChildren().addAll(NODES);
    group.getChildren().add(sun);
    getChildren().add(group);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:63,代碼來源:Splash.java


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