Tree movement

Hi,

I have some randomly generated trees in my game (these are sprites). What I want to do is apply some effect which makes the trees
‘bend’ slightly due to wind force. I think this is possible with some simple math:

treeX = (int) (originalTreeX + Math.cos(angle) * windForce);
angle+=0.1;

Problem with this is it would move the whole tree, what I need is this to be applied per pixel, can this be done in the fragment shader?

Thanks