#1: Foreground simplification, gravity improved, animation handling
simplified, code refactored, javadoc updated.