var incx: Number = 0.1;
var vx: Number = 0.0;
var vy: Number = 0.0;
Stage {
title: "Application title"
scene: Scene {
width: 500
height: 500
fill: LinearGradient {
startX: 0.0
startY: 0.0
endX: 0.0
endY: 1.0
stops: [
Stop {
color: Color.WHITE
offset: 0.0
},
Stop {
color: Color.WHITESMOKE
offset: 1.0
},
]
}
content: [
Ellipse {
centerX: 250, centerY: 250
radiusX: 200, radiusY: 200
fill: bind RadialGradient {
centerX: vx
centerY: vy
//centerX: bind vx
//centerY: bind vy
stops: [
Stop {
color: Color.LIGHTPINK
offset: 0.0
},
Stop {
color: Color.DARKRED
offset: 1.0
},
]
}
}
]
}
}
Timeline {
repeatCount: Timeline.INDEFINITE
keyFrames: [
KeyFrame {
time: 0.1s
action: function() {
vx += incx;
if (vx >= 1) {
vx = 1;
incx = incx * (-1);
} else if (vx <= 0) {
vx = 0;
incx = incx * (-1);
}
}
}
];
}.play()
Main.fx:52: centerX has script only (default) bind access in javafx.scene.paint.RadialGradient
centerX: bind vx
Main.fx:53: centerY has script only (default) bind access in javafx.scene.paint.RadialGradient
centerY: bind vy
2 errors
Pelo que eu entendi ao colocar o bind no objeto RadialGradiente sempre que o valor é alterado um novo objeto é criado... e no processo que estou tentando fazer não...
Alguém poderia me ajudar?
