-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBanner.java
More file actions
41 lines (32 loc) · 1.09 KB
/
Copy pathBanner.java
File metadata and controls
41 lines (32 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*************************************************************************
* Compilation: javac Banner.java
* Execution: java Banner s
* Dependencies: StdDraw.java
*
* Plots the String s, and moves it across the screen, left-to-right,
* wrapping around when it reaches the border.
*
* % java Banner "Hello, World"
*
*
*************************************************************************/
import java.awt.Font;
public class Banner {
public static void main(String[] args) {
String s = args[0];
// remove the 5% border
StdDraw.setXscale(1.0/22.0, 21.0/22.0);
StdDraw.setYscale(1.0/22.0, 21.0/22.0);
// set the font
Font f = new Font("Arial", Font.BOLD, 60);
StdDraw.setFont(f);
StdDraw.setPenColor(StdDraw.WHITE);
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.show(60);
}
}
}