ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Small jump in size after time mark is passed

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
David Cabestany
Small jump in size after time mark is passed
on Mar 31, 2020 at 9:07:58 pm

I'm applying the following expression to generate some scale trails with some layers.

I need to come as 1,2,3 and then leave 3,2,1.

This expression sort of works, however when the needle goes past 1 second the 3rd layer (the 2nd trailer) jumps its scale from 100 to 100.8. The layer above does not change.

I get an expression error warning from 1 second to 2 seconds and then it goes away.
The expression works despite the error warning except for the .8% jump in size.

Any help is greatly appreciated

delay = thisComp.layer("xp").effect("d")("Slider")

t=time;
d = delay*thisComp.frameDuration*(index - 1);
if
(t&lt;1)
{
s=thisComp.layer(6).scale.valueAtTime(time - d)
}

if
(t>2)
{
s=thisComp.layer(6).scale.valueAtTime(time + d)
}
s;


Return to posts index

Dan Ebberts
Re: Small jump in size after time mark is passed
on Mar 31, 2020 at 9:52:38 pm

For starters, you don't define what s is when t is between 1 and 2. I'd set it up like this:


if (t < 1){
s = // value when t less than 1
}else if (t <= 2){
s = // value when t between 1 and 2
}else{
s = // value when t > 2
}
s


I'm not sure that's the only issue, but it should help...

Dan



Return to posts index

David Cabestany
Re: Small jump in size after time mark is passed
on Mar 31, 2020 at 10:41:33 pm

Thanks Dan, that helped, but the expression seems convoluted, could a while statement work in here or it will crash the program?


Return to posts index


Dan Ebberts
Re: Small jump in size after time mark is passed
on Mar 31, 2020 at 10:48:28 pm

I don't think while will help, but what exactly are you trying to do?

Dan



Return to posts index

Dan Ebberts
Re: Small jump in size after time mark is passed
on Mar 31, 2020 at 11:09:12 pm

One problem you might be having is that there will be discontinuities at 1 and 2 seconds, where the amount of delay changes abruptly. You might want to ease through those changes with something like this (not tested at all):


easeTime = .25;
delay = thisComp.layer("xp").effect("d")("Slider");
t=time;
d = delay*thisComp.frameDuration*(index - 1);
if (t < 2){
dly = ease(t,1-easeTime,1,-d,0);
}else{
dly = ease(t,2,2+easeTime,0,d);
}
thisComp.layer(6).scale.valueAtTime(time + dly)



Dan



Return to posts index

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