made animating cubes its own function