Invention1.java
1    package npw;
2    
3    import painter.SPainter;
4    import shapes.SCircle;
5    import shapes.SSquare;
6    import note.SNote;
7    import javax.swing.*;
8    import java.awt.*;
9    import static java.lang.Thread.sleep;
10   import composer.SComposer;
11   
12   
13   public class Invention1 {
14   
15       public static void main(String[] args) throws InterruptedException {
16           Invention1();
17       }
18           private static void Invention1() throws InterruptedException {
19   
20           int radius = 400;
21           SPainter painter = new SPainter("Canvas", 800, 800);
22           SCircle circle = new SCircle(radius);
23           SSquare square = circle.circumscribingSquare();
24           int nrOfShrinks = 6;
25           SComposer note = new SComposer();
26   
27           int i = 0;
28           while (i < nrOfShrinks){
29   
30               shrinkShapes(circle, square, note);
31               paintShapes(painter, circle, square,  note, i, nrOfShrinks);
32   
33               i = i + 1;
34           }
35   
36       }
37       private static void shrinkShapes(SCircle circle, SSquare square, SComposer note){
38           circle.shrink(33);
39       }
40       private static void paintShapes(SPainter painter, SCircle circle, SSquare square, SComposer note, int i, int nrOfShrinks) throws InterruptedException {
41           if( i < 5 ) {
42               painter.setColor(Color.BLACK);
43               painter.paint(square);
44               painter.setColor(Color.YELLOW);
45               painter.paint(circle);
46               sleep(20);
47               note.lp(2);
48               note.mms1();
49           } else if( i == 5 ){
50               painter.setColor(Color.BLACK);
51               painter.paint(square);
52               painter.setColor(Color.YELLOW);
53               painter.paint(circle);
54               painter.mrt(600);
55               painter.tl(45);
56               painter.setColor(Color.BLACK);
57               painter.paint(square);
58               painter.tr(45);
59               painter.mlt(200);
60               circle.shrink(150);
61               painter.setColor(Color.BLUE);
62               painter.paint(circle);
63               painter.mlt(200);
64               painter.paint(circle);
65               painter.paint(circle);
66               painter.mlt(180);
67               painter.mfd(80);
68               circle.s2();
69               painter.setColor(Color.BLACK);
70               painter.paint(circle);
71               note.rp(20);
72               note.mms1();
73               sleep(1);
74           }
75   
76       }
77   
78       }
79   
80