Triggering animation with multiple markers
Need some help with expressions 🙂
I want to animate the position of a layer triggered by 3 different markers.
Each marker gives a different position value.
Until now all I have found on the internet are guides to trigger animation with markers using only ״In״ and ״Out״ markers or using keyframes..
I have a layer with 3 dropdown menus. which contain the same objects. (about 10 objects in each)
In the position property I wrote an array of different positions of the layer and another array of dropdown menus.
So now, each marker triggers the position of the layer to jump straight the position provided by the dropdown menu. it works fine, but I don't know how to animate it.
I thought of using the linear() method but don't know how to combine it with the expression I have already wrote...
This is the expression:
var menus = [
thisComp.layer("Sky CAT controller").effect(1)("Menu").value, // 0
thisComp.layer("Sky CAT controller").effect(2)("Menu").value, // 1
thisComp.layer("Sky CAT controller").effect(3)("Menu").value // 2
];
const markers = thisComp.layer("Sky CAT controller").marker;
let latestMarkerIndex = 0;
if (markers.numKeys > 0) {
latestMarkerIndex = markers.nearestKey(time).index;
if (markers.key(latestMarkerIndex).time > time) {
latestMarkerIndex--;
}
}
let outputText = "";
if (latestMarkerIndex > 0) {
const latestMarker = markers.key(latestMarkerIndex);
outputText = latestMarker.comment;
};
m = outputText-1;
var x = 540;
var allResults = [
[x,3287],
[x,3024],
[x,2763],
[x,2501],
[x,2239],
[x,1978],
[x,1715],
[x,1454],
[x,1192],
[x,928],
[x,664],
[x,406],
[x,141],
[x,-120],
[x,-379]
];
allResults [menus[m]-1];
Thanks in advance
