I am trying to pause a progress bar. How would I go about it? I have a listener on a Pause button where I could do the pause but I cannot stop the animation.
Here is the code that currently runs the progress bar.
Pixmap pixmap = new Pixmap(100, 50, Pixmap.Format.RGBA8888);
pixmap.setColor(Color.CYAN);
pixmap.fill();
TextureRegionDrawable drawable = new TextureRegionDrawable(new TextureRegion(new Texture(pixmap)));
pixmap.dispose();
ProgressBar.ProgressBarStyle progressBarStyle = new ProgressBar.ProgressBarStyle();
progressBarStyle.background = drawable;
pixmap = new Pixmap(0, 50, Pixmap.Format.RGBA8888);
pixmap.setColor(Color.RED);
pixmap.fill();
drawable = new TextureRegionDrawable(new TextureRegion(new Texture(pixmap)));
pixmap.dispose();
progressBarStyle.knob = drawable;
pixmap = new Pixmap(100, 50, Pixmap.Format.RGBA8888);
pixmap.setColor(Color.RED);
pixmap.fill();
drawable = new TextureRegionDrawable(new TextureRegion(new Texture(pixmap)));
pixmap.dispose();
progressBarStyle.knobBefore = drawable;
ProgressBar bar = new ProgressBar(0.0f, 1.0f, 0.01f, false, progressBarStyle);
bar.setBounds(100, 1600, 875, 50);
bar.setAnimateDuration(25)
bar.setValue(1f);
stage.addActor(bar);