how to loop a chained pattern?

how to loop a chained pattern?

Here are 3 chained patterns that I am trying to get compressed into "possibly" one line with the help of a looping mechanism like the each() method...

  1. $("#background1").css("left",(parseInt($("#background1").css("left")) - smallStarSpeed - PLAYGROUND_WIDTH) % (-2 * PLAYGROUND_WIDTH) + PLAYGROUND_WIDTH);
  2. $("#background2").css("left",(parseInt($("#background2").css("left")) - mediumStarSpeed - PLAYGROUND_WIDTH) % (-2 * PLAYGROUND_WIDTH) + PLAYGROUND_WIDTH);
  3. $("#background3").css("left",(parseInt($("#background3").css("left")) - largeStarSpeed - PLAYGROUND_WIDTH) % (-2 * PLAYGROUND_WIDTH) + PLAYGROUND_WIDTH);

how can I condense this code with jquery. The jquery documentation shows that the each() method is great for looping through arrays and objects, but can it also be used for chained patterns like ths? The only thing that is different between the 3 are the ID selector names and the small, medium and large star variables.

Thanks!



*Break through the ice and never look back*