ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Slider Value Expression Linked to Single Keyframe

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Sam Caino
Slider Value Expression Linked to Single Keyframe
on Jun 2, 2017 at 2:18:43 am

Hi Folks,

I want to control a slider value with a number in a text layer. The below expression works in my composition. However, I want to keyframe it so the first keyframe is zero and the second keyframe corresponds to the value set by the text layer in the expression ("Number").

Is there any way to modify this expression so it only attaches to the second keyframe, leaving my first keyframe value set to zero?

txt=thisComp.layer("Number").text.sourceText;
if (! isNaN(parseFloat(txt)))
parseFloat(txt)
else
value




Return to posts index

Dan Ebberts
Re: Slider Value Expression Linked to Single Keyframe
on Jun 2, 2017 at 1:03:14 pm

If they are linear keyframes, and there are only two of them, something like this should work:


txt=thisComp.layer("Number").text.sourceText;
val = parseFloat(txt);
if (numKeys > 1 && (! isNaN(val)))
linear(time,key(1).time,key(2).time,key(1).value,val)
else
value



Dan



Return to posts index

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