| 940 | }, |
| 941 | //LOOP button |
| 942 | loop = function loop(value) { |
| 943 | loopEnabled = value; |
| 944 | record("loop", loopEnabled); |
| 945 | |
| 946 | if (loopEnabled) { |
| 947 | loopAnimation.play(); |
| 948 | |
| 949 | if (linkedAnimation.progress() >= outProgress / 100) { |
| 950 | var target = linkedAnimation._targets && linkedAnimation._targets[0]; |
| 951 | |
| 952 | if (target === selectedAnimation) { |
| 953 | //in case there are callbacks on the timeline, when we jump back to the start we should seek() so that the playhead doesn't drag [backward] past those and trigger them. |
| 954 | target.seek(startTime + (endTime - startTime) * inProgress / 100); |
| 955 | } |
| 956 | |
| 957 | if (selectedAnimation._repeat && !inProgress && outProgress === 100) { |
| 958 | linkedAnimation.totalProgress(0, true); |
| 959 | } else { |
| 960 | linkedAnimation.progress(inProgress / 100, true); |
| 961 | } |
| 962 | |
| 963 | play(); |
| 964 | } |
| 965 | } else { |
| 966 | loopAnimation.reverse(); |
| 967 | } |
| 968 | }, |
| 969 | toggleLoop = function toggleLoop() { |
| 970 | return loop(!loopEnabled); |
| 971 | }, |