Небольшая демка на JavaFX, изображающая сон интернетной школоты.
Кому интересно, вот код летающей иконки:
public class DreamIconClass extends CustomNode {
override public function create(): Node {
// индекс случайной иконки
var iconindex = (new Random()).nextInt(15);
// прозрачность иконки
var opacity = 0.1;
// начальные координаты иконки
var fromX = (new Random()).nextInt(400);
var fromY = (new Random()).nextInt(300);
// конечные координаты иконки
var toX = (new Random()).nextInt(400);
var toY = (new Random()).nextInt(300);
var icon = ImageView {
opacity: bind opacity
x: bind fromX, y: bind fromY
image: Image {url: "{__DIR__}icons/{iconindex}.png"}
};
Timeline {
keyFrames: [
at (8s) {fromX => toX tween Interpolator.LINEAR;
fromY => toY tween Interpolator.LINEAR }
];
}.play();
Timeline {
keyFrames: [
at (2s) { opacity => 1.0 tween Interpolator.LINEAR }
at (6s) { opacity => 0.0 tween Interpolator.LINEAR }
];
}.play();
return icon;
}
}
А вот класс необычного заголовка окна:
public class WindowCaptionClass extends CustomNode{
public var wndStage = bind Stage.stages[0];
def fontShift = 3; // смещение шрифта
def captionHeight = 15.0; // ширина полосы заголовка
def stageWidth = bind wndStage.width;
//def stageHeight = bind wndStage.height;
// Смещения относительно начала окна (левый верхний угол) и точкой клика
var stageDragInitialX;
var stageDragInitialY;
override function create(){
return Group {
content: [
ImageView {
x: bind stageWidth - captionHeight, y: fontShift
image: Image {
url: "{__DIR__}close.png"
}
effect: DropShadow {
offsetX: 1
offsetY: 1
color: Color.BLACK
radius: 3
} // DorpShadow
onMouseClicked: function( e: MouseEvent ):Void {
wndStage.close();
}
} // ImageView
Text { // Caption
font : Font {
size: captionHeight - fontShift
}
x: 2, y: captionHeight - fontShift
content: bind wndStage.title
fill: Color.BLACK
} // Text (Caption)
Rectangle {
x: 0, y: 0
width: bind stageWidth, height: captionHeight
opacity: 0.5
fill: LinearGradient {
startX : 0.0
startY : 0.0
endX : 1.0
endY : 0.0
stops: [
Stop {
color : Color.WHITE
offset: 0.0
},
Stop {
color : Color.DARKGRAY
offset: 1.0
},
]
}
effect: DropShadow {
offsetX: 10
offsetY: 2
color: Color.BLACK
radius: 5
}
onMousePressed: function( e: MouseEvent ):Void {
stageDragInitialX = e.screenX - wndStage.x;
stageDragInitialY = e.screenY - wndStage.y;
}
onMouseDragged: function( e: MouseEvent ):Void {
wndStage.x = e.screenX - stageDragInitialX;
wndStage.y = e.screenY - stageDragInitialY;
}
} //Rectangle
] //content
} //Group
} //function create()

Эммм... Это оно у меня не правильно заработало, или современной школоте и правда столь страшные сны снятся? оО
А демо есть?
Интересно было бы взглянуть,давно ищу такую вещь