+ if (duration == 0)
+ t = link_time;
+ else if (duration > 0)
+ {
+ t -= local_time;
+ t -= floor(t / duration) * duration;
+ t = link_time + t;
+ }
+ else
+ {
+ t -= local_time;
+ t -= floor(t / -duration) * -duration;
+ t = link_time - t;
+ }
+
+ // for compatibility with v0.1 layers; before local_time is reached, take a step back
+ if (!symmetrical && time < local_time)
+ t -= duration;