I would probably do it kind of like this:
PHP Code:
//#CLIENTSIDE
function onCreated() {
this.trigger("RotateImage");
}
function onRotateImage() {
this.i += 0.05;
this.rotation = sin(this.i) + pi / 3;
this.scheduleEvent(0.05, "RotateImage", NULL);
}
If my math is correct, this should rotate the image a bit, then rotate it back. Similar to what you had written originally.