Java Reference
In-Depth Information
Progress Bar
This last example takes the animation functions one step further to create a more complex visual effect.
If you have used OS X, then you are familiar with the animated progress bars found in that operating
system. Now the example here is not a direct clone, but I thought I would mention the inspiration for the
example to show that something familiar can be animated with gradients.
Figure 8-8 shows a rounded rectangle with a number of vertical bars that appear to animate to the
right.
Figure 8-8. Animated progress bar
It is true that the OS X progress bar appears to animate to the left, but I found keeping the animation
going to the right made for a more readable example. In addition to the animated gradient, two non-
animated gradients are used to give the bar a sense of depth. Listing 8-14 shows the implementation.
Search WWH ::




Custom Search