SE450: Animation: Overview [25/28] Previous pageContentsNext page

The code presents a rough framework for animation/visualization. I have written the code to handle geometry problems similar to those of the project. You should be able to use the animator package unchanged. You will need to make some (small) changes to the visualizer. Of course, you will need to replace the model and main packages entirely.

Note that this code does not solve the problem put forth by the project. This is just a bunch of lines with bouncing dots...

To get the code, download file:myproject.zip. Unzip it, and put it in eclipse. You can run

project.main.Main

file:Main.java [source] [doc-public] [doc-private]
01
02
03
04
05
06
07
08
09
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
42
43
package myproject.main;

import myproject.model.Model;
import myproject.model.swing.SwingAnimatorBuilder;
import myproject.model.text.TextAnimatorBuilder;

/**
 * A static class to demonstrate the visualization aspect of
 * simulation.
 */
public class Main {
  private Main() {}
  public static void main(String[] args) {
    {
      Model m = new Model(new TextAnimatorBuilder(), 0, 1);
      m.run(1000);
      m.dispose();
    }
    {
      Model m = new Model(new SwingAnimatorBuilder(), 0, 1);
      m.run(1000);
      m.dispose();
    }
    {
      Model m = new Model(new TextAnimatorBuilder(), 1, 1);
      m.run(10);
      m.dispose();
    }
    {
      Model m = new Model(new SwingAnimatorBuilder(), 1, 1);
      m.run(10);
      m.dispose();
    }
    {
      Model m = new Model(new TextAnimatorBuilder(), 2, 3);
      m.run(500);
      m.run(500);
      m.dispose();
    }
    System.exit(0);
  }
}

Previous pageContentsNext page