how to draw 2 circles on animated canvas in javascript?

I've some project right here to show online: When you click button "Atom" should display 2 red circles connected by the line and 2 white balls bouncing around, but there's only animation. How can I do that? I just put static part of code into function button2. I really need help guys, its a project !