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 code:
@Override public void activate(boolean enabled) { active = enabled; plane.enabled = enabled; }
For the GeometricVisualization
class, we can enable (and disable) each of the component cubes:
@Override...