ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

How to get a time value when no keyframes

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Ihor Karas
How to get a time value when no keyframes
on Jul 26, 2017 at 8:58:37 am

Hey everyone!
I have a slider and its value is controlled by expression(something like counter of events), so I have no keyframes on it. I need to play animation of a text layer (scale from 100% to 120% and back to 100% created with keyframes) when slider value is changed.

I think it would be great to do that with approach used in "triggering animation with markers" where we reset time after each marker:

time = time - ("time of first keyframe of animation which need to be played" + "time of marker")

Does anybody know how to get a time value when slider value was changed by expression?? so that I can replace "time of marker" with this value


Return to posts index

Dan Ebberts
Re: How to get a time value when no keyframes
on Jul 26, 2017 at 3:56:43 pm

There's no way to get it in one step. You have to look for it frame-by-frame. Start at the current frame and go back until you find a frame with a different value.

Dan



Return to posts index

Ihor Karas
Re: How to get a time value when no keyframes
on Jul 30, 2017 at 8:21:03 am

Yeah, that was my first thought and wanted to make sure that there is no easier way) Thanks
So here is my code and it works, hope it will help someone

t=0;
for(var i = 0; i<timeToFrames(time); i++)
{
if(effect("Slider Control")(1).valueAtTime(framesToTime(i)) != effect("Slider Control")(1).valueAtTime(framesToTime(i-1)))
{
d=framesToTime(i);
t = time - d;
}

}
thisProperty.valueAtTime(t);


Return to posts index

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