Java Reference
In-Depth Information
fill: bind createLinearGradient([
createStop(createColor(red1, green1, blue1, 1.0), 0.0),
createStop(createColor(red2, green2, blue2, 1.0), 1.0)
]);
}
insert rect into group.content;
var anim = Timeline{
repeatCount: Timeline.INDEFINITE;
autoReverse: true;
keyFrames: [
KeyFrame{
time: 1s
values: [red1 => 1.0]
},
KeyFrame{
time: 3s
values: [
blue1 => 1.0,
green2 => 1.0,
]
},
KeyFrame{
time: 5s
values: [
red1 => 0.0,
red2 => 1.0,
]
},
KeyFrame{
time: 7s
values: [
green1 => 1.0,
blue2 => 1.0,
]
},
]
}
anim.play();
}
Listing 8-11 shows a complex animation where each component of the two colors is animated
distinctly. This creates an animation that visually flows continuously from one color to another.
Animated Stops
Changing the colors of
Stops
is a required part of creating animated gradients. The previous examples
have focused on changing the color of a
stop
within a set of
Stops
with fixed
offsets
. This example