ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Trigger keyframe from another layer's keyframes (and halfway in between) and map to slider values

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Joe Castiglioni
Trigger keyframe from another layer's keyframes (and halfway in between) and map to slider values
on Mar 20, 2019 at 1:14:48 pm

Okay I know what I would like to do , I just don't quite know how to get the expression language to do it. This animation involves a ribbon of particles following an arrow connecting 2 points on a map. I want to taper the size of the particle stream so it's larger in the middle. I've got keyframes set up to do this now, but if I could replace those keyframes with an expression it could save a lot of time moving keyframes later and allow me global control of those taper values.



Here's what I want:

If Position keyframe of layer below this layer is keyframe #1, particle emitter size=“beginning size” slider value from control layer

If position keyframe of layer below this layer is keyframe #2, particle emitter size=“end size” slider value from control layer

At the time halfway between keyframe #1 and keyframe #2 on the layer below this layer, the particle emitter size=“middle size” slider value from control layer

Does that make sense? Seems like it should be possible but I don't have my mind wrapped around how to make it happen. If anyone could has ideas for me I'd greatly appreciate it!

Joe Castiglioni
Video Person


Return to posts index

Tomas Bumbulevičius
Re: Trigger keyframe from another layer's keyframes (and halfway in between) and map to slider values
on Mar 20, 2019 at 3:45:58 pm
Last Edited By Tomas Bumbulevičius on Mar 20, 2019 at 3:47:48 pm

Hey Joe,

try applying this below to Size expression.

Few notes:
1. This is assuming your 'Montana Arrow' has two keyframes for position. If not - change key index accordingly.
2. Animation is based on X position change.
3. Change 'startSize', 'middleSize' and 'endSize' to affect the size. Ideally, link them to sliders for global control over things.
4. Animation half point is in the middle of position transformation.

animRef = thisComp.layer("Montana Arrow").transform.position;
startKeyIndex = 1;
endKeyIndex = 2;
animStartTime = animRef.key(startKeyIndex).time;
animEndTime = animRef.key(endKeyIndex).time;
animMiddleTime = animStartTime + (animEndTime - animStartTime)/2;

animStart = animRef.key(startKeyIndex).value[0];
animEnd = animRef.key(endKeyIndex).value[0];
animMiddle = animRef.valueAtTime(animMiddleTime)[0];

startSize = 2;
middleSize = 6;
endSize = 10;


if (time &lt;= animMiddleTime){
ease(animRef[0], animStart, animMiddle, startSize, middleSize)
}else{
ease(animRef[0], animMiddle, animEnd, middleSize, endSize)
}


Find out more:
After Effects Tutorials: motion design, expressions, scripting.


Return to posts index

Joe Castiglioni
Re: Trigger keyframe from another layer's keyframes (and halfway in between) and map to slider values
on Mar 20, 2019 at 5:22:23 pm

Thank you SO MUCH for replying. I was able to make this work exactly how I wanted! I got an error and fiddled around and had to switch the order of the elements in the ease array in the if/else section for some reason, but it totally works!

Where would you recommend going to learn more about how to think about creating expressions?

Joe Castiglioni
Video Person


Return to posts index


Tomas Bumbulevičius
Re: Trigger keyframe from another layer's keyframes (and halfway in between) and map to slider values
on Mar 20, 2019 at 8:03:17 pm

You are welcome, Joe! In order to get a grasp of expressions, firstly I would recommend to check these . You will get a general sense of scope possible with expressions and then it is just a matter of implementing solutions (not to forget a tiny bit of programming knowledge essential needs)

Cheers!

Find out more:
After Effects Tutorials: motion design, expressions, scripting.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]