I need to come up with a way to make three big letters look like they're being typed/written.
I can create Letters with paintComponent();
I need ideas/example on how to accomplish this?
This is what i already done.
public class LetterWriter extends JPanel {
private String[] alphabets;
private Font font;
public LetterWriter() {
createComponents();
layoutComponents();
}
public void createComponents() {
alphabets = new String[]{"A","B","C"};
String[] fonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
font = new Font(fonts[7],1,500);
}
public void layoutComponents() {
}
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g.create();
g2d.setFont(font);
g2d.drawString(alphabets[0],getWidth()/7,getHeight()-50);
}
public static void main(String[] args) {
LetterWriter demo = new LetterWriter();
JFrame frame = new JFrame();
Container cp = frame.getContentPane();
cp.add(demo);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(500, 500);
frame.setLocation(500, 500);
frame.setVisible(true);
}
}
Some ideas:
make a video and play it (same with a .gif for example)
split the Letter in small pieces and paint these Pieces one after another
define a path and let a "pencil" paint itself on a n dynamically created image