how to run a function simultaneously with animation?

how to run a function simultaneously with animation?

hello to you smart peoples,

how can I make a function work on an element while at the same time the animate method is applying to it?

as example, I want to make an element that change its height and his background position move by 100px
every half a second.

thank you!
AsafKey