
// AnimatedHanoi.java
// Robert Sedgewick and Kevin Wayne
// Slightly reformatted by Andrew Davison, Nov. 2022

// https://introcs.cs.princeton.edu/java/15inout/Banner.java.html
/*
   Plots the String s, and moves it across the screen, left-to-right,
   wrapping around when it reaches the border.
 
   Usage:
     >  compile Banner.java
     > run Banner <string>
   e.g.
     > run Banner "Hello, World"
 
 
*/

import java.awt.Font;

public class Banner
{

  public static void main(String[] args)
  {
    if (args.length != 1) {
      System.out.println("Usage: run Banner <string>");
      return;
    }

    String s = args[0];

    // set the font
    Font font = new Font("Arial", Font.BOLD, 80);
    StdDraw.setFont(font);
    StdDraw.setPenColor(StdDraw.WHITE);
    StdDraw.enableDoubleBuffering();

    for (double i = 0.0; true; i += 0.01) {
      StdDraw.clear(StdDraw.BLACK);
      StdDraw.text((i % 1.0),       0.5, s);
      StdDraw.text((i % 1.0) - 1.0, 0.5, s);
      StdDraw.text((i % 1.0) + 1.0, 0.5, s);
      StdDraw.pause(60);
      StdDraw.show();
    }
  } /* main */

}
