The value for angle, e.g. cta, should be increasing from 0...350, ... 360, 361...
Why the value jump back to zero? You must have added some code to make the change.
Add a variable for "connection" property for trace, and add code to change it's value from true to false when you do not want connected line.