-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCompMarkerTimeRemap.js
More file actions
64 lines (58 loc) · 1.97 KB
/
Copy pathCompMarkerTimeRemap.js
File metadata and controls
64 lines (58 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
Time remaps sections in a source comp enclosed within composition markers with durations.
Markers may be placed in a different order than that of the source comp and may have a
different duration than that of the source comp.
What won't affect proper behavior
- Markers with comments that don't exist in the source comp and markers without comments
will be ignored.
Restrictions
- Comments of the layer marker must correspond to comp markers in the source composition.
- You may see strange behavior with Motion Blur on.
*/
if (marker.numKeys == 0) value;
else {
currMarker = null;
targetSourceMarker = null;
t = 0;
n = marker.nearestKey(time).index;
if (time < marker.key(n).time) --n;
if (n == 0) n = 1;
currMarker = marker.key(n);
for (;;) {
try {
currMarker = marker.key(n);
targetSourceMarker = source.marker.key(currMarker.comment);
break;
}
catch (e) {
if (currMarker.index == 1) {
if (marker.numKeys == 1) {
n = -1;
break;
}
else {
for (i = 2; i < marker.numKeys; ++i) {
if (marker.key(i).comment != "") {
n = i;
break;
}
}
if (n == 1) n = -1;
}
}
else --n;
}
}
if (n != -1) {
if (time < marker.key(1).time)
targetSourceMarker.time;
else if (time >= currMarker.time, time < currMarker.time + currMarker.duration) {
linear(time, currMarker.time, currMarker.time + currMarker.duration,
targetSourceMarker.time,
targetSourceMarker.time + targetSourceMarker.duration);
}
else
targetSourceMarker.time + targetSourceMarker.duration;
}
else value;
}