Forums › Adobe After Effects Expressions › Expression
Saso Goricar
February 26, 2020 at 7:57 pmHello,
I’ve created an animation of the stroke width from 0 to 10px with keyframes. Is there a way to create an expression, that I can change the width of the second keyframe with a controller?
Thanks, Saso
Marticus Kilverticus
February 28, 2020 at 3:19 pmSo long as youre only going between 2 keyframes, make a new slider somwhere with your width on it, then apply this to the strokes width:
width = (pickwhip to a new number slider);
linear(0,10,0,width)That just replaces 10 with your new sliders value.
Alex Printz
February 28, 2020 at 3:22 pmI’ve posted code below; just make sure your 2nd key’s value is different than the first key’s value (0px vs 10px).
linear(value, key(1).value, key(2).value, key(1).value, effect("Slider Value")(1))
Alex Printz
Mograph DesignerSaso Goricar
February 28, 2020 at 6:32 pmYes, you are both right, I used this linear expression
var y = comp("MOGRT").layer("MOGRT Controls").effect("Slider Control")("Slider")
linear(y,0,20,0,20);
I allowed max 20px of width.Thanks both for the idea for using this expression, I didn’t know that I could use it this way.
Saso Goricar
February 28, 2020 at 6:36 pmNo, It’s not working. The expression disable keyframes. I can control the width, but the width doesn’t animate from 0 to 20
Alex Printz
February 28, 2020 at 8:49 pmUse my expression above. The expression posted by the other user isn’t pulling anything from keyframes.
Alex Printz
Mograph DesignerSaso Goricar
February 28, 2020 at 9:15 pmNow I got it, it works perfectly. Thanks for the help with my problem, it works. Thanks again.
Log in to reply.