Also, besides the 'jerky' forward motion, they do sway back and forth.
It's part of their defensive strategy to blend in with the leaves and branches swaying in the breeze.
If they were straight and static, the movement of their surroundings would surely give them away to a predator.