J
avaFX中effect包的Bloom类的简单使用方法
请看图:
源代码如下:
- /*
- * BloomEffect.fx
- *
- * Created on Dec 30, 2008, 10:50:56 PM
- */
- package effects;
- import javafx.scene.effect.Blend;
- import javafx.scene.effect.BlendMode;
- import javafx.scene.effect.Bloom;
- import javafx.scene.effect.Flood;
- import javafx.scene.Group;
- import javafx.scene.paint.Color;
- import javafx.scene.Scene;
- import javafx.scene.text.Font;
- import javafx.scene.text.Text;
- import javafx.stage.Stage;
- /**
- * 效果不是很好:):)
- */
- Stage {
- title: "Bloom Effect Usage"
- width: 250
- height: 200
- scene: Scene {
- content:[
- Group{
- translateY:-50.0;//在y轴上平移
- effect:Bloom{ // 效果对象
- input:Blend{ // 混合效果
- topInput:Flood{ // 顶端输入
- paint:Color.YELLOW;
- x:45;
- y:45;
- width:150;
- height:150;
- }
- bottomInput:Flood{// 底端输入
- paint:Color.GREEN
- x:66
- y:66
- width:123
- height: 123
- }
- mode:BlendMode.SRC_OUT// 混合模式
- }
- }
- // 内容
- content: Text {
- font: Font { // 字体样式
- size: 24
- }
- x: 10,
- y: 30
- content: "Application content"
- }
- }
- ]
- }
- }