Using new Documentation https://greensock.com/docs/TimelineMax/repeat()
<div id="rect"></div>
var tl2 = new TimelineMax({ repeat: 10 })
.to("#rect", 0.5, { rotation: -10, transformOrigin:"left top" })
.to("#rect", 0.5, { rotation: 10 })
.repeat(-1);
https://codepen.io/hiteshsahu/pen/LoBWgv?editors=1010