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


Java Lighting类代码示例

本文整理汇总了Java中javafx.scene.effect.Lighting的典型用法代码示例。如果您正苦于以下问题:Java Lighting类的具体用法?Java Lighting怎么用?Java Lighting使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getNamedEffectList

import javafx.scene.effect.Lighting; //导入依赖的package包/类
List<NamedEffect> getNamedEffectList() {
    List<NamedEffect> nes = new ArrayList<NamedEffect>();
    nes.add(new NamedEffect("default", new Lighting()));
    nes.add(new NamedEffect("distant light", new Lighting() {{
        setLight(new Distant() {{ setAzimuth(90f); setElevation(50);}});}}));
    nes.add(new NamedEffect("point light", new Lighting() {{
        setLight(new Point() {{ setX(70);setY(120);setZ(10);}});}}));
    nes.add(new NamedEffect("spot light", new Lighting() {{
        setLight(new Spot() {{
            setX(70);setY(120);setZ(50);
            setPointsAtX(150);setPointsAtY(0);setPointsAtZ(0);
        }});}}));

    nes.add(new NamedEffect("diffuse: 0.5", new Lighting() {{ setDiffuseConstant(0.5f);}}));
    nes.add(new NamedEffect("specularC: 1.5", new Lighting() {{ setSpecularConstant(1.5f);}}));
    nes.add(new NamedEffect("specularExp: 35", new Lighting() {{ setSpecularExponent(35f);}}));
    nes.add(new NamedEffect("scale: 7", new Lighting() {{ setSurfaceScale(7f);}}));
    nes.add(new NamedEffect("bump input", new Lighting() {{ setBumpInput(new DropShadow());}}));
    nes.add(new NamedEffect("content input", new Lighting() {{ setContentInput(new DropShadow());}}));

    return nes;
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:23,代码来源:CanvasEffects2App.java

示例2: createMovingCircle

import javafx.scene.effect.Lighting; //导入依赖的package包/类
private Circle createMovingCircle(Interpolator interpolator) {
    //create a transparent circle
    Circle circle = new Circle(45,45, 40,  Color.web("1c89f4"));
    circle.setOpacity(0);
    //add effect
    circle.setEffect(new Lighting());

    //create a timeline for moving the circle
   
    timeline.setCycleCount(Timeline.INDEFINITE);
    timeline.setAutoReverse(true);

    //create a keyValue for horizontal translation of circle to the position 155px with given interpolator
    KeyValue keyValue = new KeyValue(circle.translateXProperty(), 155, interpolator);

    //create a keyFrame with duration 4s
    KeyFrame keyFrame = new KeyFrame(Duration.seconds(4), keyValue);

    //add the keyframe to the timeline
    timeline.getKeyFrames().add(keyFrame);

    return circle;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:TimelineInterpolator.java

示例3: createMovingCircle

import javafx.scene.effect.Lighting; //导入依赖的package包/类
private Circle createMovingCircle(Interpolator interpolator, Color color){
    Circle circle = new Circle(25,25,35,color);
    circle.setOpacity(0.0);
    //add effect
    circle.setEffect(new Lighting());

    //create a timeline for moving the circle
       
    timeline.setCycleCount(Timeline.INDEFINITE);
    timeline.setAutoReverse(true);

    //create a keyValue for horizontal translation of circle to the position 155px with given interpolator
    KeyValue keyValue = new KeyValue(circle.translateXProperty(), 155, interpolator);

    //create a keyFrame with duration 4s
    KeyFrame keyFrame = new KeyFrame(Duration.seconds(4), keyValue);
    
    //add the keyframe to the timeline
    timeline.getKeyFrames().add(keyFrame);
    
    return circle;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:23,代码来源:InterpolatorSample.java

示例4: TimelineSample

import javafx.scene.effect.Lighting; //导入依赖的package包/类
public TimelineSample() {
    super(280,120);

    //create a circle
    final Circle circle = new Circle(25,25, 20,  Color.web("1c89f4"));
    circle.setEffect(new Lighting());

    //create a timeline for moving the circle
    timeline = new Timeline();        
    timeline.setCycleCount(Timeline.INDEFINITE);
    timeline.setAutoReverse(true);

    //one can start/pause/stop/play animation by
    //timeline.play();
    //timeline.pause();
    //timeline.stop();
    //timeline.playFromStart();
    
    //add the following keyframes to the timeline
    timeline.getKeyFrames().addAll
        (new KeyFrame(Duration.ZERO,
                      new KeyValue(circle.translateXProperty(), 0)),
         new KeyFrame(new Duration(4000),
                      new KeyValue(circle.translateXProperty(), 205)));


    getChildren().add(createNavigation());
    getChildren().add(circle);
    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Timeline rate", timeline.rateProperty(), -4d, 4d)
            //TODO it is possible to do it for integer?
    );
    // END REMOVE ME
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:36,代码来源:TimelineSample.java

示例5: CardGroup

import javafx.scene.effect.Lighting; //导入依赖的package包/类
public CardGroup() {
    hoverBox = new Group();
    hoverBox.setLayoutX(10);
    hoverBox.setLayoutY(0);
    text = new Text();
    text.setFont(GUIManager.font);
    text.setFill(Color.BLACK);
    text.setWrappingWidth(300);
    text.setLayoutY(34);
    text.setLayoutX(10);
    if (GUIManager.enableDropShadowEffect)
        text.setEffect(new DropShadow());
    bg = new Rectangle(300, 30, Color.GOLD);
    bg.setArcHeight(10);
    bg.setArcWidth(10);
    hoverBox.getChildren().add(bg);
    hoverBox.getChildren().add(text);
    if (GUIManager.enableLightingEffect)
        bg.setEffect(new Lighting());
    hoverBox.setOpacity(0);
    getChildren().add(hoverBox);
    deltaH = 20;
    if (!LocalMessages.getLocale().equals(new Locale("zh", "CN")))
        deltaH = 35;
    // hoverBox.setOpacity(0);
}
 
开发者ID:tjumyk,项目名称:sevenwonders,代码行数:27,代码来源:CardGroup.java

示例6: init

import javafx.scene.effect.Lighting; //导入依赖的package包/类
private void init(Stage primaryStage) {
    Group root = new Group();
    primaryStage.setResizable(false);
    primaryStage.setScene(new Scene(root, 260,100));
    //create a circle with effect
    final Circle circle = new Circle(20,  Color.rgb(156,216,255));
    circle.setEffect(new Lighting());
    //create a text inside a circle
    final Text text = new Text (i.toString());
    text.setStroke(Color.BLACK);
    //create a layout for circle with text inside
    final StackPane stack = new StackPane();
    stack.getChildren().addAll(circle, text);
    stack.setLayoutX(30);
    stack.setLayoutY(30);

    //create a timeline for moving the circle

    timeline = new Timeline();
    timeline.setCycleCount(Timeline.INDEFINITE);
    timeline.setAutoReverse(true);

    //one can add a specific action when each frame is started. There are one or more frames during
    // executing one KeyFrame depending on set Interpolator.
    timer = new AnimationTimer() {
        @Override
        public void handle(long l) {
            text.setText(i.toString());
            i++;
        }

    };

    //create a keyValue with factory: scaling the circle 2times
    KeyValue keyValueX = new KeyValue(stack.scaleXProperty(), 2);
    KeyValue keyValueY = new KeyValue(stack.scaleYProperty(), 2);

    //create a keyFrame, the keyValue is reached at time 2s
    Duration duration = Duration.seconds(2);
    //one can add a specific action when the keyframe is reached
    EventHandler<ActionEvent> onFinished = new EventHandler<ActionEvent>() {
        public void handle(ActionEvent t) {
             stack.setTranslateX(java.lang.Math.random()*200);
             //reset counter
             i = 0;
        }
    };

    KeyFrame keyFrame = new KeyFrame(duration, onFinished , keyValueX, keyValueY);

    //add the keyframe to the timeline
    timeline.getKeyFrames().add(keyFrame);

    root.getChildren().add(stack);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:56,代码来源:TimelineEvents.java

示例7: configureEffect

import javafx.scene.effect.Lighting; //导入依赖的package包/类
private void configureEffect() {
    handEffect.setOffsetX(radius / 40);
    handEffect.setOffsetY(radius / 40);
    handEffect.setRadius(6);
    handEffect.setColor(Color.web("#000000"));

    Lighting lighting = new Lighting();
    Light.Distant light = new Light.Distant();
    light.setAzimuth(225);
    lighting.setLight(light);
    handEffect.setInput(lighting);

    handEffectGroup.setEffect(handEffect);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:StopWatch.java

示例8: createBackground

import javafx.scene.effect.Lighting; //导入依赖的package包/类
private Rectangle createBackground(Color stroke, Color fill) {
    Rectangle background = new Rectangle(14, 17, fill);
    background.setStroke(stroke);
    background.setStrokeWidth(2);
    background.setEffect(new Lighting());
    background.setCache(true);
    return background;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:StopWatch.java

示例9: TimelineEventsSample

import javafx.scene.effect.Lighting; //导入依赖的package包/类
public TimelineEventsSample() {
    super(70,70);
    //create a circle with effect
    final Circle circle = new Circle(20,  Color.rgb(156,216,255));
    circle.setEffect(new Lighting());
    //create a text inside a circle
    final Text text = new Text (i.toString());
    text.setStroke(Color.BLACK);
    //create a layout for circle with text inside
    final StackPane stack = new StackPane();
    stack.getChildren().addAll(circle, text);
    stack.setLayoutX(30);
    stack.setLayoutY(30);

    //create a timeline for moving the circle

    timeline = new Timeline();
    timeline.setCycleCount(Timeline.INDEFINITE);
    timeline.setAutoReverse(true);

    //one can add a specific action when each frame is started. There are one or more frames during
    // executing one KeyFrame depending on set Interpolator.
    timer = new AnimationTimer() {
        @Override
        public void handle(long l) {
            text.setText(i.toString());
            i++;
        }

    };

    //create a keyValue with factory: scaling the circle 2times
    KeyValue keyValueX = new KeyValue(stack.scaleXProperty(), 2);
    KeyValue keyValueY = new KeyValue(stack.scaleYProperty(), 2);

    //create a keyFrame, the keyValue is reached at time 2s
    Duration duration = Duration.seconds(2);
    //one can add a specific action when the keyframe is reached
    EventHandler<ActionEvent> onFinished = new EventHandler<ActionEvent>() {
        public void handle(ActionEvent t) {
             stack.setTranslateX(java.lang.Math.random()*200-100);
             //reset counter
             i = 0;
        }
    };

    KeyFrame keyFrame = new KeyFrame(duration, onFinished , keyValueX, keyValueY);

    //add the keyframe to the timeline
    timeline.getKeyFrames().add(keyFrame);

    getChildren().add(stack);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:54,代码来源:TimelineEventsSample.java

示例10: StageSample

import javafx.scene.effect.Lighting; //导入依赖的package包/类
public StageSample() {
    //create a button for initializing our new stage
    Button button = new Button("Create a Stage");
    button.setStyle("-fx-font-size: 24;");
    button.setDefaultButton(true);
    button.setOnAction(new EventHandler<ActionEvent>() {
        @Override public void handle(ActionEvent t) {
            final Stage stage = new Stage();
            //create root node of scene, i.e. group
            Group rootGroup = new Group();
            //create scene with set width, height and color
            Scene scene = new Scene(rootGroup, 200, 200, Color.WHITESMOKE);
            //set scene to stage
            stage.setScene(scene);
            //center stage on screen
            stage.centerOnScreen();
            //show the stage
            stage.show();
            //add some node to scene
            Text text = new Text(20, 110, "JavaFX");
            text.setFill(Color.DODGERBLUE);
            text.setEffect(new Lighting());
            text.setFont(Font.font(Font.getDefault().getFamily(), 50));
            //add text to the main root group
            rootGroup.getChildren().add(text);
        }
    });
    getChildren().add(button);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:30,代码来源:StageSample.java

示例11: trophyize

import javafx.scene.effect.Lighting; //导入依赖的package包/类
public static Text trophyize(String text, Integer tier, Double size) {
    Text node = new Text(text);
    node.setFill(tierColor(tier));
    node.setFont(Font.font(fa.getFamily(), size));
    Lighting l = new Lighting();
    l.setSurfaceScale(5.0f);
    node.setEffect(l);
    return node;
}
 
开发者ID:NonlinearFruit,项目名称:Retrospector,代码行数:10,代码来源:AchievementFX.java

示例12: createCenterDot

import javafx.scene.effect.Lighting; //导入依赖的package包/类
private Circle createCenterDot(double centerX, double centerY, double radius) {
	Circle centerDot = new Circle(radius * 0.2, Color.BLACK);
	centerDot.setEffect(new Lighting());
	centerDot.setOpacity(0.8);
	centerDot.setLayoutX(centerX);
	centerDot.setLayoutY(centerY);
	return centerDot;
}
 
开发者ID:alexejsailer,项目名称:FXGraphs,代码行数:9,代码来源:Place.java

示例13: createOuterCircle

import javafx.scene.effect.Lighting; //导入依赖的package包/类
private Circle createOuterCircle(double centerX, double centerY, double radius) {
	Circle outerCircle = new Circle(radius, Color.GRAY);
	outerCircle.setEffect(new Lighting());
	outerCircle.setStroke(Color.BLACK);
	outerCircle.setStrokeWidth(2);
	outerCircle.setStrokeType(StrokeType.OUTSIDE);
	outerCircle.setOpacity(0.4);
	outerCircle.setLayoutX(centerX);
	outerCircle.setLayoutY(centerY);
	setConnectionBounderyNode(outerCircle);
	return outerCircle;
}
 
开发者ID:alexejsailer,项目名称:FXGraphs,代码行数:13,代码来源:Place.java

示例14: PlaceView

import javafx.scene.effect.Lighting; //导入依赖的package包/类
public PlaceView(double centerX, double centerY, double radius) {

		Circle circle = new Circle(radius + 30, Color.GRAY);
		circle.setEffect(new Lighting());
		circle.setStroke(Color.BLACK);
		circle.setStrokeWidth(2);
		circle.setStrokeType(StrokeType.OUTSIDE);
		circle.setOpacity(0.4);
		circle.setLayoutX(centerX);
		circle.setLayoutY(centerY);

		Circle circle1 = new Circle(radius + 25, Color.WHITE);
		circle1.setLayoutX(centerX);
		circle1.setLayoutY(centerY);

		Circle circle2 = new Circle(radius - 20, Color.BLACK);
		circle2.setEffect(new Lighting());
		circle2.setOpacity(0.8);
		circle2.setLayoutX(centerX);
		circle2.setLayoutY(centerY);

		Circle anchor = new Circle(10, Color.BLACK);
		anchor.setLayoutX(centerX);
		anchor.setLayoutY(centerY);

		setAnchor(anchor);
		getChildren().add(circle);
		getChildren().add(circle1);
		getChildren().add(circle2);

	}
 
开发者ID:alexejsailer,项目名称:FXGraphs,代码行数:32,代码来源:PlaceView.java

示例15: makeGrid

import javafx.scene.effect.Lighting; //导入依赖的package包/类
private Shape makeGrid() {
    Shape shape = new Rectangle((COLUMNS + 1) * TILE_SIZE, (ROWS + 1) * TILE_SIZE);

    for (int y = 0; y < ROWS; y++) {
        for (int x = 0; x < COLUMNS; x++) {
            Circle circle = new Circle(TILE_SIZE / 2);
            circle.setCenterX(TILE_SIZE / 2);
            circle.setCenterY(TILE_SIZE / 2);
            circle.setTranslateX(x * (TILE_SIZE + 5) + TILE_SIZE / 4);
            circle.setTranslateY(y * (TILE_SIZE + 5) + TILE_SIZE / 4);

            shape = Shape.subtract(shape, circle);
        }
    }

    Light.Distant light = new Light.Distant();
    light.setAzimuth(45.0);
    light.setElevation(30.0);

    Lighting lighting = new Lighting();
    lighting.setLight(light);
    lighting.setSurfaceScale(5.0);

    shape.setFill(Color.BLUE);
    shape.setEffect(lighting);

    return shape;
}
 
开发者ID:AlmasB,项目名称:FXTutorials,代码行数:29,代码来源:Connect4App.java


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