ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

color1 to color2 animation triggered by maximum position.speed?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
JuanLuis Vich
color1 to color2 animation triggered by maximum position.speed?
on Feb 5, 2019 at 5:14:26 pm

Hi!
I'm trying to go from color 1 to color 2, but based on the position speed of the layer. So we start with color 1 when the object has 0 speed, then the animation of the position starts, and when the position goes at its max speed, it triggers the fading to the color 2, so when the object stops the animation (so has 0 speed again), we will see color2

it would be something similar to this effect here I read at an old post here (https://forums.creativecow.net/readpost/227/24965)

amt = .01;
effect("Motion Tile")("Tile Center").speed*amt


but adapting to affect the colors, and make the color 2 stay when the speed is again 0, (and not going back to color 1 if the speed is 0)

soo, basically: color 1 when position speed is 0 -----object starts moving -----reaches max speed ----fades to color 2----- the object is 0 again but we are in color 2

any idea will be super welcome! thanks!


Return to posts index

Dan Ebberts
Re: color1 to color2 animation triggered by maximum position.speed?
on Feb 5, 2019 at 6:00:38 pm

The problem is that maximum speed isn't something that's readily available to an expression. On each frame, the expression will have to examine the speed at every frame between the in point and the out point to see if the maximum has been reached yet. So performance could be an issue if your comp is long. If that's the case, you might want to convert the expression to keyframes once it works the way you want it to. In any case, this should be close to what you're looking for:


color1 = [1,1,0,1]; // yellow
color2 = [1,0.5,0,1]; // orange
fadeTime = 1;
max = 0;
t = inPoint;
tMax = t;
while (t < outPoint){
if (Math.abs(position.speedAtTime(t)) > max){
max = Math.abs(position.speedAtTime(t));
tMax = t;
}
t += thisComp.frameDuration;
}
tFade = Math.max(time-tMax,0);
linear(tFade,0,fadeTime,color1,color2);



Dan



Return to posts index

JuanLuis Vich
Re: color1 to color2 animation triggered by maximum position.speed?
on Feb 5, 2019 at 6:51:07 pm

great! thanks!

mmm do you think if I add a manual threshold, (so it doesnt have to calculate that max value), the performance won't get insane?


Return to posts index


Dan Ebberts
Re: color1 to color2 animation triggered by maximum position.speed?
on Feb 5, 2019 at 6:57:40 pm

I guess that would help some, but the expression would still have to check every previous frame to see if the speed had ever exceeded the threshold and calculate how long ago that happened.


Dan



Return to posts index

JuanLuis Vich
Re: color1 to color2 animation triggered by maximum position.speed?
on Feb 5, 2019 at 7:13:16 pm

oh! jeez! well, I will convert to keyframes then...

many thanks! you have been super helpful!


Return to posts index

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