Animation between markers

Understand the code
Post Reply
filipsbaumanis
Posts: 2
Joined: May 3rd, 2022, 2:04 am

Hello,
I've always been more of a design/creative type of guy rather than a mathematics/logics/coding type of a guy. This seams like a basic thing to solve, but I've spent several hours and still couldn't come up with solution. I'm working on a project where i'd like animation to happen between markers. It should work regardless how many markers there are (obviously more than 2)
- it should animate from 0 to 100 in between the markers
- reset to 0 and start all over again as the play head reaches next marker.
- continue like that until the last marker is reached

Image
here is a quick example i created with keyframes, but would be great if the same thing could be achieved by expressions. Can you help?

filipsbaumanis
Posts: 2
Joined: May 3rd, 2022, 2:04 am

Ok. Zero responses. Looks like this forum is dead. 4 months later I figured this out myself. Just in case anyone else finds it useful - here is the Expression code for the scale parameter:

n = 0;
if (thisLayer.marker.numKeys > 0){
n = thisLayer.marker.nearestKey(time).index;

if (thisLayer.marker.key(n).time > time){ n--; }
}

if (n == 0){
value;

}else{

try{
animIn = thisLayer.marker.key(n).time;
animOut = thisLayer.marker.key(n+1).time;

w = linear(time, animIn, animOut, 0, 100);

[w,100];

}catch (err){
value;
}
}

Post Reply