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


Java Node.setOpacity方法代碼示例

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


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

示例1: dataItemAdded

import javafx.scene.Node; //導入方法依賴的package包/類
@Override protected void dataItemAdded(Series<Number, Number> series, int itemIndex, Data<Number, Number> item) {
    Node candle = createCandle(getData().indexOf(series), item, itemIndex);
    if (shouldAnimate()) {
        candle.setOpacity(0);
        getPlotChildren().add(candle);
        // fade in new candle
        FadeTransition ft = new FadeTransition(Duration.millis(500), candle);
        ft.setToValue(1);
        ft.play();
    } else {
        getPlotChildren().add(candle);
    }
    // always draw average line on top
    if (series.getNode() != null) {
        series.getNode().toFront();
    }
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:18,代碼來源:AdvCandleStickChartSample.java

示例2: seriesAdded

import javafx.scene.Node; //導入方法依賴的package包/類
@Override protected void seriesAdded(Series<Number, Number> series, int seriesIndex) {
    // handle any data already in series
    for (int j = 0; j < series.getData().size(); j++) {
        Data item = series.getData().get(j);
        Node candle = createCandle(seriesIndex, item, j);
        if (shouldAnimate()) {
            candle.setOpacity(0);
            getPlotChildren().add(candle);
            // fade in new candle
            FadeTransition ft = new FadeTransition(Duration.millis(500), candle);
            ft.setToValue(1);
            ft.play();
        } else {
            getPlotChildren().add(candle);
        }
    }
    // create series path
    Path seriesPath = new Path();
    seriesPath.getStyleClass().setAll("candlestick-average-line", "series" + seriesIndex);
    series.setNode(seriesPath);
    getPlotChildren().add(seriesPath);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:23,代碼來源:AdvCandleStickChartSample.java

示例3: seriesAdded

import javafx.scene.Node; //導入方法依賴的package包/類
@Override
protected void seriesAdded(Series<X, Y> series, int seriesIndex) {
	// create new path for series
	Path seriesLine = new Path();
	seriesLine.setStrokeLineJoin(StrokeLineJoin.BEVEL);
	series.setNode(seriesLine);
	// create series Y multiplier
	DoubleProperty seriesYAnimMultiplier = new SimpleDoubleProperty(this, "seriesYMultiplier");
	seriesYMultiplierMap.put(series, seriesYAnimMultiplier);
	// handle any data already in series
	if (shouldAnimate()) {
		seriesLine.setOpacity(0);
		seriesYAnimMultiplier.setValue(0d);
	} else {
		seriesYAnimMultiplier.setValue(1d);
	}
	getPlotChildren().add(seriesLine);

	List<KeyFrame> keyFrames = new ArrayList<KeyFrame>();
	if (shouldAnimate()) {
		// animate in new series
		keyFrames.add(new KeyFrame(Duration.ZERO, new KeyValue(seriesLine.opacityProperty(), 0),
				new KeyValue(seriesYAnimMultiplier, 0)));
		keyFrames.add(new KeyFrame(Duration.millis(200), new KeyValue(seriesLine.opacityProperty(), 1)));
		keyFrames.add(new KeyFrame(Duration.millis(500), new KeyValue(seriesYAnimMultiplier, 1)));
	}
	for (int j = 0; j < series.getData().size(); j++) {
		Data<X, Y> item = series.getData().get(j);
		final Node symbol = createSymbol(series, seriesIndex, item, j);
		if (symbol != null) {
			if (shouldAnimate())
				symbol.setOpacity(0);
			getPlotChildren().add(symbol);
			if (shouldAnimate()) {
				// fade in new symbol
				keyFrames.add(new KeyFrame(Duration.ZERO, new KeyValue(symbol.opacityProperty(), 0)));
				keyFrames.add(new KeyFrame(Duration.millis(200), new KeyValue(symbol.opacityProperty(), 1)));
			}
		}
	}
	if (shouldAnimate())
		animate(keyFrames.toArray(new KeyFrame[keyFrames.size()]));
}
 
開發者ID:JKostikiadis,項目名稱:MultiAxisCharts,代碼行數:44,代碼來源:MultiAxisLineChart.java

示例4: apply

import javafx.scene.Node; //導入方法依賴的package包/類
public void apply(ObservableBooleanValue trigger, Node node) {
    this.trigger = trigger;
    this.node = node;
    configureTransition(node);
    node.getProperties().put(ANIMATION_TRIGGER_KEY, trigger); // Prevents trigger from being garbage collected.
    trigger.addListener(triggerChangeListener);
    node.setOpacity(trigger.get() ? to : from);
}
 
開發者ID:rmfisher,項目名稱:fx-animation-editor,代碼行數:9,代碼來源:FadeInAnimator.java

示例5: dataItemAdded

import javafx.scene.Node; //導入方法依賴的package包/類
@Override
protected void dataItemAdded(Series<X, Y> series, int itemIndex, Data<X, Y> item) {
	final Node symbol = createSymbol(series, getData().indexOf(series), item, itemIndex);
	if (shouldAnimate()) {
		boolean animate = false;
		if (itemIndex > 0 && itemIndex < (series.getData().size() - 1)) {
			animate = true;
			Data<X, Y> p1 = series.getData().get(itemIndex - 1);
			Data<X, Y> p2 = series.getData().get(itemIndex + 1);
			double x1 = getXAxis().toNumericValue(p1.getXValue());
			double y1 = getY1Axis().toNumericValue(p1.getYValue());
			double x3 = getXAxis().toNumericValue(p2.getXValue());
			double y3 = getY1Axis().toNumericValue(p2.getYValue());

			double x2 = getXAxis().toNumericValue(item.getXValue());
			double y2 = getY1Axis().toNumericValue(item.getYValue());

			// //1. y intercept of the line : y = ((y3-y1)/(x3-x1)) * x2 + (x3y1 - y3x1)/(x3
			// -x1)
			double y = ((y3 - y1) / (x3 - x1)) * x2 + (x3 * y1 - y3 * x1) / (x3 - x1);
			item.setCurrentY(getY1Axis().toRealValue(y));
			item.setCurrentX(getXAxis().toRealValue(x2));
			// 2. we can simply use the midpoint on the line as well..
			// double x = (x3 + x1)/2;
			// double y = (y3 + y1)/2;
			// item.setCurrentX(x);
			// item.setCurrentY(y);
		} else if (itemIndex == 0 && series.getData().size() > 1) {
			animate = true;
			item.setCurrentX(series.getData().get(1).getXValue());
			item.setCurrentY(series.getData().get(1).getYValue());
		} else if (itemIndex == (series.getData().size() - 1) && series.getData().size() > 1) {
			animate = true;
			int last = series.getData().size() - 2;
			item.setCurrentX(series.getData().get(last).getXValue());
			item.setCurrentY(series.getData().get(last).getYValue());
		}
		if (symbol != null) {
			// fade in new symbol
			symbol.setOpacity(0);
			getPlotChildren().add(symbol);
			FadeTransition ft = new FadeTransition(Duration.millis(500), symbol);
			ft.setToValue(1);
			ft.play();
		}
		if (animate) {
			animate(new KeyFrame(Duration.ZERO, (e) -> {
				if (symbol != null && !getPlotChildren().contains(symbol)) {
					getPlotChildren().add(symbol);
				}
			}, new KeyValue(item.currentYProperty(), item.getCurrentY()),
					new KeyValue(item.currentXProperty(), item.getCurrentX())),
					new KeyFrame(Duration.millis(800),
							new KeyValue(item.currentYProperty(), item.getYValue(), Interpolator.EASE_BOTH),
							new KeyValue(item.currentXProperty(), item.getXValue(), Interpolator.EASE_BOTH)));
		}

	} else if (symbol != null) {
		getPlotChildren().add(symbol);
	}
}
 
開發者ID:JKostikiadis,項目名稱:MultiAxisCharts,代碼行數:62,代碼來源:MultiAxisAreaChart.java

示例6: seriesAdded

import javafx.scene.Node; //導入方法依賴的package包/類
@Override
protected void seriesAdded(MultiAxisChart.Series<X, Y> series, int seriesIndex) {
	// create new paths for series
	Path seriesLine = new Path();
	Path fillPath = new Path();
	seriesLine.setStrokeLineJoin(StrokeLineJoin.BEVEL);
	Group areaGroup = new Group(fillPath, seriesLine);
	series.setNode(areaGroup);
	// create series Y multiplier
	DoubleProperty seriesYAnimMultiplier = new SimpleDoubleProperty(this, "seriesYMultiplier");
	seriesYMultiplierMap.put(series, seriesYAnimMultiplier);
	// handle any data already in series
	if (shouldAnimate()) {
		seriesYAnimMultiplier.setValue(0d);
	} else {
		seriesYAnimMultiplier.setValue(1d);
	}
	getPlotChildren().add(areaGroup);
	List<KeyFrame> keyFrames = new ArrayList<KeyFrame>();
	if (shouldAnimate()) {
		// animate in new series
		keyFrames.add(new KeyFrame(Duration.ZERO, new KeyValue(areaGroup.opacityProperty(), 0),
				new KeyValue(seriesYAnimMultiplier, 0)));
		keyFrames.add(new KeyFrame(Duration.millis(200), new KeyValue(areaGroup.opacityProperty(), 1)));
		keyFrames.add(new KeyFrame(Duration.millis(500), new KeyValue(seriesYAnimMultiplier, 1)));
	}
	for (int j = 0; j < series.getData().size(); j++) {
		Data<X, Y> item = series.getData().get(j);
		final Node symbol = createSymbol(series, seriesIndex, item, j);
		if (symbol != null) {
			if (shouldAnimate()) {
				symbol.setOpacity(0);
				getPlotChildren().add(symbol);
				// fade in new symbol
				keyFrames.add(new KeyFrame(Duration.ZERO, new KeyValue(symbol.opacityProperty(), 0)));
				keyFrames.add(new KeyFrame(Duration.millis(200), new KeyValue(symbol.opacityProperty(), 1)));
			} else {
				getPlotChildren().add(symbol);
			}
		}
	}
	if (shouldAnimate())
		animate(keyFrames.toArray(new KeyFrame[keyFrames.size()]));
}
 
開發者ID:JKostikiadis,項目名稱:MultiAxisCharts,代碼行數:45,代碼來源:MultiAxisAreaChart.java


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