Java Reference
In-Depth Information
Figure 9-4. Disco effect
In Figure 9-4 we can see a circular region of the screen composed of rays emitting from the center.
The rays are multicolored. This effect borrows heavily from the chapter on particles, as the source code
in Listing 9-9 shows.
Listing 9-9. DiscoStar.fx
public class DiscoStar extends AudioVisualization{
var lastEmit = DateTime{}
var showFlare = bind soundPlayer.hiChannels on replace {
if (soundPlayer.hiChannels > 3){
var now = DateTime{};
if (now.instant - lastEmit.instant > 100){
lastEmit = now;
addFlare();
}
}
}
Search WWH ::




Custom Search