Hi everyone, thanks for your continued support of the AE community!
I originally posted this under the expressions discussions, but as I look under the hood a little more it seems this is more of a script-based challenge.
Inspired by Lloyd Alvarez's recent expressions, I'm trying to create an interactive way to compress position based on sets of markers. Here's the process I'm trying to work through, though not much success with my basic knowledge of iterative loops:
1. start with 2 linear-interpolation position keyframes to indicate start and end position of the layer
2. somewhere between these keyframes, add 4 markers - marker.key(1) and marker.key(4) indicate the positional values where the compression of the motion will take place; marker.key(2).time indicates the new time of marker.key(1).value; marker.key(3).time indicates the new time of marker.key(4).value (see image attached)
3. run script to remap positions values, and add easing between marker.key(2) and marker.key(3) to create the overall effect of constant velocity -> speed ramp -> constant velocity
4. if there are multiple compressions within the start and end keyframes, perform an iterative check for sets of 4 markers [1,2,3,4] and [5,6,7,8] and remap values accordingly, keeping motion linear outside these sets of 4 markers.
I know this can be done by precomposing and time-remapping, I'd prefer to keep it on one layer in one comp and have it done with markers.
thanks for your help, Peter
Script to compress motion using marker sets
Moderator: byronnash
-
- Posts: 320
- Joined: June 26th, 2004, 10:01 am
- Location: Folsom, CA
- Contact:
I think it's better as an expression. ![Wink ;-)](./images/smilies/icon_wink.gif)
It needs two keyrames and 4 markers to do anything.
Dan
![Wink ;-)](./images/smilies/icon_wink.gif)
It needs two keyrames and 4 markers to do anything.
Code: Select all
if (marker.numKeys >= 4 && numKeys >= 2){
inTime = key(1).time;
outTime = key(2).time;
t1 = marker.key(1).time;
t2 = marker.key(2).time;
t3 = marker.key(3).time;
t4 = marker.key(4).time;
if (time < t2){
t = linear(time,inTime,t2,inTime,t1);
}else if (time <= t3){
t = ease(time,t2,t3,t1,t4);
}else{
t = linear(time,t3,outTime,t4,outTime);
}
valueAtTime(t)
}else{
value
}
Dan
- reubenlara
- Posts: 10
- Joined: March 16th, 2018, 6:22 am
Be sure to check out Marker Remap http://aescripts.com/marker-remap which builds an After Effects panel around split layer markers and has the additional bonus of a robust marker management panel. Gives AE CC 2019's new Responsive Design features a run for it's money!