I am reading "Algorithms 4th Edition" by Robert Sedgewick and Kevin Wayne.
Using StdDraw
, we can create animation:
package general_test;
import edu.princeton.cs.algs4.StdDraw;
public class AnimationTest {
public static void main(String[] args) {
// TODO Auto-generated method stub
StdDraw.setScale(-2, +2);
StdDraw.enableDoubleBuffering();
for (double t = 0.0; true; t += 0.02) {
double x = Math.sin(t);
double y = Math.cos(t);
StdDraw.clear();
StdDraw.filledCircle(x, y, 0.05);
StdDraw.filledCircle(-x, -y, 0.05);
StdDraw.show();
StdDraw.pause(20);
}
}
}
I want to save this animation as a file.
How can I save this animation as a file?
Any easy way?