package effectsplayground.control;
import javafx.animation.*;
import javafx.scene.*;
import javafx.scene.paint.*;
import javafx.scene.shape.*;
public class CloseButton extends CustomNode {
def size = 8;
var color = Color.rgb(153, 153, 153);
def fade = Timeline {
keyFrames: [
at (0s) {
color => Color.rgb(153, 153, 153);
},
at (0.2s) {
color => Color.WHITE;
}
]
}
override protected function create() : Node {
Group {
var g:Group;
cursor: Cursor.HAND
cache: true
content: [
Rectangle {
x: bind g.layoutBounds.minX
y: bind g.layoutBounds.minY
width: bind g.layoutBounds.width
height: bind g.layoutBounds.height
fill: Color.TRANSPARENT
},
g = Group {
content: [
Line {
startX: 0
startY: 0
endX: size
endY: size
stroke: bind color
strokeWidth: 3
strokeLineCap: StrokeLineCap.ROUND
},
Line {
startX: 0
startY: size
endX: size
endY: 0
stroke: bind color
strokeWidth: 3
strokeLineCap: StrokeLineCap.ROUND
},
]
}
]
onMouseEntered: function(e) {
fade.rate = 1;
fade.play();
}
onMouseExited: function(e) {
fade.rate = -1;
fade.play();
}
}
}
}