精华帖 (4) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2009-05-12
最后修改:2009-08-09
相关文章: [在JavaFX使用多维数组 ] [自己编程写的JavaFX 演示游戏 ] [JavaFX和Java之间的互操作性 ] [JavaFX的Effect功能例子:编写许愿树程序(2) ] [JavaFX的Effect功能例子:编写许愿树程序(3) ]
本文着重介绍了用JavaFX的effect功能来实现用户图形界面(GUI)。 /* * Main.fx * * http://www.javafxblogs.com * */ package wishtree; import javafx.scene.effect.GaussianBlur; import javafx.scene.effect.PerspectiveTransform; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.input.MouseEvent; import javafx.scene.paint.Color; import javafx.scene.paint.LinearGradient; import javafx.scene.paint.Stop; import javafx.scene.Scene; import javafx.scene.text.Font; import javafx.scene.text.FontWeight; import javafx.scene.text.Text; import javafx.stage.Stage; /** * @author Henry Zhang * JavaFX编程 http://javafxguy.iteye.com * JavaFX技术交流应用 http://www.javafxblogs.com */ var xx = 170; var yy = 430; var tree : ImageView = ImageView { x: 80 y: 0 image: Image { url: "{__DIR__}images/tree.png" width: 640 preserveRatio: true } }; var tree2 = Image { url: "{__DIR__}images/tree2.png" width: 130 preserveRatio: true }; var stage = Stage { title: "Wish Tree" width: 830 height: 620 resizable: false scene: Scene { fill: LinearGradient { startX: 0, startY: 0.0, endX: 0, endY: 1.0 proportional: true stops: [ Stop { offset: 0.0 color: Color.web("#14acf8") }, Stop { offset: 1.0 color: Color.web("#a4e6f8") }] } content: [ ImageView { x: 50 y: 280 image: Image { url: "{__DIR__}images/cloud2.png" preserveRatio: true width: 160 } effect: GaussianBlur { radius: 25 } }, ImageView { x: 520 y: 300 image: Image { url: "{__DIR__}images/cloud2.png" preserveRatio: true width: 150 } effect: GaussianBlur { radius: 33 } }, ( JavaFX Demo Game http://www.javafxgame.com ) ImageView { x: 560 y: 500 image: tree2 }, ImageView { x: 460 y: 470 image: tree2 }, ImageView { x: 60 y: 500 image: tree2 }, ImageView { x: 190 y: 470 image: tree2 }, tree, ImageView { x: 120 y: 360 image: Image { url: "{__DIR__}images/sign.png" width: 180 preserveRatio: true } }, ImageView { x: 20 y: 60 image: Image { url: "{__DIR__}images/cloud2.png" preserveRatio: true width: 250 } effect: GaussianBlur { radius: 40 } }, ImageView { x: 520 y: 90 image: Image { url: "{__DIR__}images/cloud2.png" preserveRatio: true width: 100 } effect: GaussianBlur { radius: 20} }, ImageView { x: 620 y: 190 image: Image { url: "{__DIR__}images/cloud2.png" preserveRatio: true width: 180 } effect: GaussianBlur { radius: 25} }, ImageView { x: 600 y: 380 image: Image { url: "{__DIR__}images/cloud2.png" preserveRatio: true width: 150 } effect: GaussianBlur { radius: 33 } }, ImageView { x: 0 y: 490 image: Image { url: "{__DIR__}images/cloud.png" } effect: GaussianBlur { radius: 30 } }, Text { x:170 y: 450 content: "许愿树" fill: Color.YELLOW font: Font.font ( null, FontWeight.BOLD, 30); effect: PerspectiveTransform { ulx: xx uly: yy urx: xx+80 ury: yy-10 llx: xx-2 lly: yy+40 lrx: xx+80 lry: yy+38 } } ] } }
fill: LinearGradient { startX: 0 startY: 0 endX: 0 endY: 1.0 proportional: true stops: [ Stop { offset: 0.0 color: Color.web("#14acf8") }, Stop { offset: 1.0 color: Color.web("#a4e6f8") }] }
ImageView { x: 20 y: 60 image: Image { url: "{__DIR__}images/cloud2.png" preserveRatio: true width: 250 } effect: GaussianBlur { radius: 40 } }
preserveRatio: true width: 250
Text { x:170 y: 450 content: "许愿树" fill: Color.YELLOW font: Font.font ( null, FontWeight.BOLD, 30); effect: PerspectiveTransform { ulx: xx uly: yy urx: xx+80 ury: yy-10 llx: xx-2 lly: yy+40 lrx: xx+80 lry: yy+38 } }
本文同步发表于:JavaFX编程应用:许愿树
( 未完待续, 下一篇: 用JavaFX的Effect功能编写许愿树程序(2) )
Hobby Master 飞机 坦克 军事 模型 JavaFX例子和实例 JavaFX培训教程
声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
浏览 2400 次