ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Change value on particular keyframe with expression

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Hannes Paulsson
Change value on particular keyframe with expression
on Oct 23, 2013 at 8:33:39 pm

Hi!

I'm doing a project where I need to have a few different settings set by a bunch of expression controls on a null.
The thing is that a different people are supposed to be able to open up the project, change the parameters and then just hit render.

Everything is working out fine, except one thing. I have one element that is kind of like a speedometer. I want anyone to be able to set a max number for how far the meter goes, but it should always start at zero.

The way i imagine i would do this is to set two keyframes, one at zero and one that I want to be controlled by the slider.

The animation then uses a wiggle (set by a different slider that they don't see), that adds a bit of wiggle between the two keyframes.

So, is there a way to set just one of the keyframes to be linked to a slider?

Or could I perhaps make a value that starts at 0 at a given time, and then animates to the a adjustable value during a set time?

Thanks,
Hannes


Return to posts index


Kevin Camp
Re: Change value on particular keyframe with expression
on Oct 24, 2013 at 12:01:30 am

you can use the timing of the keys and interpolate new values using ease() or linear() functions, so something like this may work for you.

max = thisComp.layer("Null 1").effect("Slider Control")("Slider");
min = 0;
w = wiggle(5,5);
t1 = key(1).time;
t2 = key(2).time
if (time<=t1) min;
else if (time>t1 && time<t2) ease(time,t1,t2,min,max) + w;
else max;


obviously change the 'Null 1' layer to your control null name and you can change the w value to your wiggle values and link it to your slider.

since the expression adds wiggle(), you'll want to set the actual values for both key frames to 0.

Kevin Camp
Senior Designer
KCPQ, KMYQ & KRCW


Return to posts index

Hannes Paulsson
Re: Change value on particular keyframe with expression
on Oct 24, 2013 at 7:11:47 pm

Thanks! This works perfectly!


Return to posts index


Mohimanul Howladar
Re: Change value on particular keyframe with expression
on Apr 26, 2018 at 9:59:59 am

Works but i have get this type extend number and ti's not work with Math.round(),
How can i make if round figer



Return to posts index

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