Java 类javafx.scene.paint.RadialGradientBuilder 实例源码

项目:enders_game    文件:Bullet.java   
/**
* The constructor for a bullet.
* 
* @param radius - the radius of the bullet
* @param fill - the color of the bullet highlight
*/
  public Bullet(double radius, Color fill) {
      sphere = CircleBuilder.create()
              .centerX(radius)
              .centerY(radius)
              .radius(radius)
              .cache(true)
              .build();

      RadialGradient rgrad = RadialGradientBuilder.create()
                  .centerX(sphere.getCenterX() - sphere.getRadius() / 3)
                  .centerY(sphere.getCenterY() - sphere.getRadius() / 3)
                  .radius(sphere.getRadius())
                  .proportional(false)
                  .stops(new Stop(0.0, fill), new Stop(1.0, Settings.BULLET_PRIMARY_COLOR))
                  .build();

      sphere.setFill(rgrad);
  }
项目:Fishification    文件:FishWorld.java   
/**
 * Draws the background of the aquarium.
 */
private void fillAquariumBackground() {

    RadialGradientBuilder gradientBuilder = RadialGradientBuilder.create();
    gradientBuilder.centerX(getWorldCanvas().getWidth() / 2);
    gradientBuilder.centerY(50);
    gradientBuilder.radius(1000);
    gradientBuilder.proportional(false);
    gradientBuilder.stops(new Stop(0.0, Color.WHITE), new Stop(0.05, Color.rgb(245, 251, 251)),
                          new Stop(0.1, Color.rgb(220, 242, 239)), new Stop(0.2, Color.rgb(164, 214, 211)),
                          new Stop(0.3, Color.rgb(142, 195, 199)), new Stop(0.4, Color.rgb(111, 170, 184)),
                          new Stop(0.5, Color.rgb(84, 145, 166)), new Stop(0.6, Color.rgb(61, 125, 152)),
                          new Stop(0.7, Color.rgb(50, 111, 140)), new Stop(0.8, Color.rgb(33, 96, 129)),
                          new Stop(0.9, Color.rgb(25, 85, 121)), new Stop(1.0, Color.rgb(19, 77, 115)));
    RadialGradient gradient = gradientBuilder.build();

    getWorldCanvas().setFill(gradient);
}
项目:Fishification    文件:BubbleEntity.java   
private Circle createBubbleCircle(double radius) {
    CircleBuilder<?> circleBuilder = CircleBuilder.create();
    circleBuilder.radius(radius);
    circleBuilder.cache(true);
    Circle sphere = circleBuilder.build();
    sphere.setOpacity(BUBBLE_OPACITY);

    RadialGradientBuilder gradientBuilder = RadialGradientBuilder.create();
    gradientBuilder.centerX(sphere.getCenterX() - sphere.getRadius() / 3);
    gradientBuilder.centerY(sphere.getCenterY() - sphere.getRadius() / 3);
    gradientBuilder.radius(sphere.getRadius());
    gradientBuilder.proportional(false);
    gradientBuilder.stops(new Stop(0.0, Color.BLUE), new Stop(1.0, Color.BLACK));
    RadialGradient gradient = gradientBuilder.build();

    sphere.setFill(gradient);
    return sphere;
}
项目:Fishification    文件:FoodItemEntity.java   
private Circle createFoodCircle(double radius) {
    CircleBuilder<?> circleBuilder = CircleBuilder.create();
    circleBuilder.radius(radius);
    circleBuilder.cache(true);
    Circle sphere = circleBuilder.build();
    sphere.setOpacity(FOOD_OPACITY);

    RadialGradientBuilder gradientBuilder = RadialGradientBuilder.create();
    gradientBuilder.centerX(sphere.getCenterX() - sphere.getRadius() / 3);
    gradientBuilder.centerY(sphere.getCenterY() - sphere.getRadius() / 3);
    gradientBuilder.radius(sphere.getRadius());
    gradientBuilder.proportional(false);

    if (m_foodSource.equalsIgnoreCase("twitter")) {
        gradientBuilder.stops(new Stop(0.0, Color.LIGHTCYAN), new Stop(1.0, Color.DARKCYAN));
    } else if (m_foodSource.equalsIgnoreCase("sociotech")) {
        gradientBuilder.stops(new Stop(0.0, Color.GRAY), new Stop(1.0, Color.DARKGRAY));
    } else if (m_foodSource.equalsIgnoreCase("cscm")) {
        gradientBuilder.stops(new Stop(0.4, Color.ORANGE), new Stop(1.0, Color.BLACK));
    } else if (m_foodSource.equalsIgnoreCase("unibwm")) {
        gradientBuilder.stops(new Stop(0.0, Color.DARKORANGE), new Stop(1.0, Color.BLACK));
    } else if (m_foodSource.equalsIgnoreCase("mendeley")) {
        gradientBuilder.stops(new Stop(0.0, Color.RED), new Stop(1.0, Color.BLACK));
    } else if (m_foodSource.equalsIgnoreCase("studiendekan")) {
        gradientBuilder.stops(new Stop(0.0, Color.SANDYBROWN), new Stop(1.0, Color.BLACK));
    } else {
        gradientBuilder.stops(new Stop(0.0, Color.YELLOW), new Stop(1.0, Color.BLACK));
    }
    RadialGradient gradient = gradientBuilder.build();

    sphere.setFill(gradient);
    return sphere;
}