in this case if the object has a certain radius (I hope it's roudn in shape ) you can do this
remove the lines
r0 = at time t0 obj.radius -- previous radius
r1 = at time t1 obj.radius -- current radius
and then change the line
angle = 360*len/((r0+r1)*pi) -- rotation amount (in degs)
angle = 360*len/(X*pi) -- rotation amount (in degs)
where X is the diameter (2 times the raidus) of your object.