ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

get a value at a certain keyframe

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Tom Durham
get a value at a certain keyframe
on May 29, 2013 at 10:42:20 pm

Greetings Folks,

Looking for a simple way to grab a value of a given property of a given layer at a certain keyframe on that property.

Specifically, I've got a shape layer with a keyframed rectangle width (just two keyframes). I'm creating a matching rectangle that needs to START with the width the first one ended at.

Thanks so much! People in this forum are amazing.

-Tom





================================================
YOU can help save TimeSpace. Join the Chronos Protectorate!

http://www.95ers.com
http://www.SpaceAceMedia.com


Return to posts index


Dan Ebberts
Re: get a value at a certain keyframe
on May 29, 2013 at 11:31:01 pm

Something like this should work:

s = thisComp.layer("Shape Layer 1").content("Rectangle 1").content("Rectangle Path 1").size;
s.valueAtTime(s.key(s.numKeys).time)[0]


Dan



Return to posts index

Tom Durham
Re: get a value at a certain keyframe
on May 30, 2013 at 3:58:16 pm

As always thanks so much Dan.

It was giving me an error (something about 2 dimensions) with the [0] so I removed it and it worked like a charm. Any idea why?

Quick question: Where in that expression does it tell it to look at the second keyframe?





================================================
YOU can help save TimeSpace. Join the Chronos Protectorate!

http://www.95ers.com
http://www.SpaceAceMedia.com


Return to posts index



Dan Ebberts
Re: get a value at a certain keyframe
on May 30, 2013 at 4:18:39 pm

>Any idea why?

You mentioned that you wanted the width, so the [0] isolates the width part of the 2D size parameter.

>Where in that expression does it tell it to look at the second keyframe?

The expression looks for the last keyframe, which is what s.numKeys does.

Dan



Return to posts index

eduardo asta
Re: get a value at a certain keyframe
on Jul 19, 2019 at 4:06:08 pm

Hello Dan,

I have a similar problem. I have a shape layer with two key frames on Trim Paths. I want to grab the second Trim Paths keyframe value and link it to a slider.

Do you if it is possible?


Return to posts index

Tomas Bumbulevičius
Re: get a value at a certain keyframe
on Jul 19, 2019 at 8:30:40 pm

Eduardo - you can't alter the value of keyframe itself by a slider.

Instead of using keyframes, you could use interpolation methods, which can be controlled by sliders then.

Find out more:
After Effects Tutorials: motion design, expressions, scripting.
Boxer - Dynamic Text Boxes Template with a Live Preview


Return to posts index


eduardo asta
Re: get a value at a certain keyframe
on Jul 19, 2019 at 10:07:52 pm

Hello Thomas,

I guess my question wasn't clear. I could solve my problem using, yes, a liner method.

Thanks for the website you sent to me. I didn't know it.

if (numKeys > 1){
t1 = key(1).time;
t2 = key(2).time;
v1 = 0;
v2 = effect("Posicao")("Slider"); &lt;----this one allows me to set by a slider the initial position of my layer
linear(time,t1,t2,v1,v2);
}else value


Return to posts index

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