Java Reference
In-Depth Information
},
Stop{
offset: 1.0
color: Color.YELLOW
},
]
}
}
var v3 = VBox{
content: [rect3, Label{text:"Proportional Radial"}]
}
var rect4 = Rectangle{
width: 100
height: 100
fill: RadialGradient{
proportional: false
radius: 20
centerX: 30
centerY: 30
stops: [
Stop{
offset: 0.0
color: Color.BLUE
},
Stop{
offset: 1.0
color: Color.YELLOW
},
]
}
}
var v4 = VBox{
content: [rect4, Label{text:"Fixed Radius Radial"}]
}
var hbox = HBox{
spacing: 20
translateX: 80
translateY: 200
content: [v1,v2,v3,v4]
}
insert hbox into group.content;
}
In Listing 8-1 there are three rectangles created, each with a different fill applied. The rectangle
rect1 has a proportional LinearGradient applied and only the most basic information is required—just
two stop values. This causes the entire rectangle to have a gradient on it. When the non-proportional
LinearGradient is applied to rect2 , a region is specified where the gradient is drawn. The
RadialGradients work in the same way.
Search WWH ::




Custom Search