add test and implement to calculate next frame