animation of balls on a screen using multithreading