当前位置: 首页>>代码示例>>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;未经允许,请勿转载。