Random visualizations

We can switch between visualizations by adding and removing them over time. In the following example, we start with one active visualization and then every few seconds, toggle a random visualization on or off.

First, add an activate method to the abstract Visualization class, which takes a Boolean enabled parameter. The Boolean active variable is read-only:

    public boolean active = true;
    public abstract void activate(boolean enabled);

Its implementation will depend on the specific visualization. RenderBox library provides an enabled flag that's used when we render objects. The ones that instantiate a single Plane component are the easiest, such as WaveformVisualization and FFTVisualization. To each of these, add the following ...

Get Cardboard VR Projects for Android now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.