Java Reference
In-Depth Information
def rect = Rectangle { x: 200 y: 100 width: 100 height: 50 };
def circ = Circle { centerX: 200 centerY: 100 radius: 50 };
def poly = Polygon { points: [200, 50, 300, 150, 150, 150] };
def morph = DelegateShape {
shape :poly
fill: LinearGradient {
startX: 0, endX: 0, startY: 0, endY: 1
stops: [
Stop { offset: 0, color: Color.BLUE }
Stop { offset: 1, color: Color.WHITE }
]
}
stroke:Color.NAVY
strokeWidth:4
}
var t = Timeline {
autoReverse:true
repeatCount:Timeline.INDEFINITE
keyFrames: [
KeyFrame { time: 2s values: morph.shape => rect tween
Interpolator.EASEBOTH]},
KeyFrame { time: 4s values: morph.shape => circ},
KeyFrame { time: 6s values: morph.shape => poly},
]
};
t.play();
When the animation is played, you will see the different shapes smoothly transition from the
rectangle, circle, and the polygon, as shown in the following screenshot.
 
Search WWH ::




Custom Search